Class CaldavServerRest

java.lang.Object
org.exoplatform.caldav.rest.CaldavServerRest

@RestController @RequestMapping("/servers") public class CaldavServerRest extends Object
REST access to the CalDAV server registry. Reads are open to every authenticated user — the rows are credential-free by construction, and the browser needs the names and URLs to offer the connectors. Writes are for platform administrators; the ACL decision itself lives in the service, this layer only maps its exceptions onto statuses (404 for a missing object, 403 for a refused access, 400 with the message code for an invalid input — note the legacy JAX-RS resource of this add-on answers 401 where the org contract says 403; this new controller follows the contract).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.exoplatform.caldav.model.CaldavServer
    createServer(jakarta.servlet.http.HttpServletRequest request, org.exoplatform.caldav.model.CaldavServer server)
    Declares a new CalDAV server.
    void
    deleteServer(jakarta.servlet.http.HttpServletRequest request, long serverId)
    Deletes a declared CalDAV server, refused with a 409 — carrying caldav.server.referenced:<count> — while connected accounts still reference it.
    org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource>
    getServerImage(jakarta.servlet.http.HttpServletRequest request, long serverId)
    Serves the uploaded image of a declared CalDAV server — the icon the admin table and the connectors list render.
    List<org.exoplatform.caldav.model.CaldavServer>
    getServers(jakarta.servlet.http.HttpServletRequest request)
    Lists every declared CalDAV server, active or not — the admin section shows both, and nothing in a row is secret.
    org.exoplatform.caldav.model.CaldavServer
    setServerActive(jakarta.servlet.http.HttpServletRequest request, long serverId, boolean active)
    Activates or deactivates a declared CalDAV server.
    org.exoplatform.caldav.model.CaldavServer
    updateServer(jakarta.servlet.http.HttpServletRequest request, long serverId, org.exoplatform.caldav.model.CaldavServer server)
    Updates a declared CalDAV server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CaldavServerRest

      public CaldavServerRest()
  • Method Details

    • getServers

      @GetMapping @Secured("users") public List<org.exoplatform.caldav.model.CaldavServer> getServers(jakarta.servlet.http.HttpServletRequest request)
      Lists every declared CalDAV server, active or not — the admin section shows both, and nothing in a row is secret.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      Returns:
      every registration
    • createServer

      @PostMapping @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer createServer(jakarta.servlet.http.HttpServletRequest request, @RequestBody org.exoplatform.caldav.model.CaldavServer server)
      Declares a new CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      server - registration to create
      Returns:
      the created registration, carrying its id and provider name
    • updateServer

      @PutMapping("/{serverId}") @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer updateServer(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId, @RequestBody org.exoplatform.caldav.model.CaldavServer server)
      Updates a declared CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      server - new values of the registration
      Returns:
      the updated registration
    • setServerActive

      @PatchMapping("/{serverId}/status") @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer setServerActive(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId, @RequestParam("active") boolean active)
      Activates or deactivates a declared CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      active - whether users may connect to this server
      Returns:
      the updated registration
    • deleteServer

      @DeleteMapping("/{serverId}") @Secured("administrators") public void deleteServer(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId)
      Deletes a declared CalDAV server, refused with a 409 — carrying caldav.server.referenced:<count> — while connected accounts still reference it.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
    • getServerImage

      @GetMapping("/{serverId}/image") @Secured("users") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getServerImage(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId)
      Serves the uploaded image of a declared CalDAV server — the icon the admin table and the connectors list render.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      Returns:
      the image bytes as PNG