Class AgendaCalendarLinkRest
The feed is the one handler of this WAR reachable without a session.
The portal's security chain lets any request, anonymous included, through to
/rest/ and leaves the decision to method security; every other handler
carries @Secured("users"), the feed deliberately none — its token is
its credential. AgendaRestSecurityTest pins that it stays the only
one.
No rule lives here. Who may manage a link and when a link answers are
AgendaCalendarLinkService's; this resource maps its exceptions to
statuses and renders its answers. The asking user comes from the session,
never from a parameter.
A refusal writes its own body, {"message": "<code>"}, never
cached — the drawer translates the code; see refusal(org.springframework.http.HttpStatus, java.lang.String).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringExtension of the feed URL: many calendar applications expect it.static final StringPath of the feed under the WAR's REST root, token and extension appended.static final StringThe kind of a calendar a user owns.static final StringThe kind of a calendar a space owns. -
Constructor Summary
ConstructorsConstructorDescriptionAgendaCalendarLinkRest(org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.social.core.manager.IdentityManager identityManager) Builds the resource. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?> deleteCalendarLink(jakarta.servlet.http.HttpServletRequest request, long calendarId) Deletes the link of a calendar.org.springframework.http.ResponseEntity<byte[]> getCalendarFeed(String token) Serves the calendar a link publishes, to a calendar application with no eXo session.org.springframework.http.ResponseEntity<?> getCalendarLink(jakarta.servlet.http.HttpServletRequest request, long calendarId) Tells whether a calendar has a link, who created it, when, whether it still answers, and — while it answers and can be displayed — its URL.org.springframework.http.ResponseEntity<?> getCalendarLinks(jakarta.servlet.http.HttpServletRequest request) Lists the link of every calendar the user may manage one for and that has one, working or stopped — so a page draws every calendar's publishing state with one request.org.springframework.http.ResponseEntity<?> saveCalendarLink(jakarta.servlet.http.HttpServletRequest request, long calendarId) Creates the link of a calendar, replacing the one it has: the previous URL stops answering at once.
-
Field Details
-
FEED_PATH
Path of the feed under the WAR's REST root, token and extension appended.- See Also:
-
FEED_EXTENSION
Extension of the feed URL: many calendar applications expect it.- See Also:
-
PERSONAL
The kind of a calendar a user owns.- See Also:
-
SPACE
The kind of a calendar a space owns.- See Also:
-
-
Constructor Details
-
AgendaCalendarLinkRest
@Autowired public AgendaCalendarLinkRest(org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.social.core.manager.IdentityManager identityManager) Builds the resource.- Parameters:
calendarLinkService- holder of every calendar link ruleagendaCalendarService- reads the calendars a listing namesidentityManager- used to name the creator of a link and the owner of a calendar
-
-
Method Details
-
getCalendarLinks
@GetMapping("calendars/links") @Secured("users") public org.springframework.http.ResponseEntity<?> getCalendarLinks(jakarta.servlet.http.HttpServletRequest request) Lists the link of every calendar the user may manage one for and that has one, working or stopped — so a page draws every calendar's publishing state with one request. Never cached: an entry can carry a working capability URL.- Parameters:
request- the authenticated request- Returns:
- the links, each with its calendar's title and kind
-
getCalendarLink
@GetMapping("calendars/{calendarId}/link") @Secured("users") public org.springframework.http.ResponseEntity<?> getCalendarLink(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId) Tells whether a calendar has a link, who created it, when, whether it still answers, and — while it answers and can be displayed — its URL. Only someone allowed to manage the link gets an answer at all, and the answer is never cached: its body can carry a working capability URL, and the portal's security chain writes no cache header of its own.- Parameters:
request- the authenticated requestcalendarId- technical identifier of the calendar- Returns:
- the status of the calendar's link
-
saveCalendarLink
@PostMapping("calendars/{calendarId}/link") @Secured("users") public org.springframework.http.ResponseEntity<?> saveCalendarLink(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId) Creates the link of a calendar, replacing the one it has: the previous URL stops answering at once. The answer carries the new URL, and is never cached.- Parameters:
request- the authenticated requestcalendarId- technical identifier of the calendar- Returns:
- the status of the new link, with its URL
-
deleteCalendarLink
@DeleteMapping("calendars/{calendarId}/link") @Secured("users") public org.springframework.http.ResponseEntity<?> deleteCalendarLink(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId) Deletes the link of a calendar.- Parameters:
request- the authenticated requestcalendarId- technical identifier of the calendar- Returns:
- no content
-
getCalendarFeed
@GetMapping("ical/{token}.ics") public org.springframework.http.ResponseEntity<byte[]> getCalendarFeed(@PathVariable("token") String token) Serves the calendar a link publishes, to a calendar application with no eXo session. Deliberately not@Secured: the token is the credential.Every link that opens nothing — unknown, replaced, deleted, or whose creator lost their right — gets the same bodiless 404. The token never reaches a log line or a response.
The 304 is Spring MVC's, not this method's: for a GET answering an
ETag,HttpEntityMethodProcessorcompares it with the request'sIf-None-Matchand drops the body itself.AgendaCalendarLinkRestTestpins the behaviour through the dispatcher.- Parameters:
token- the token presented in the URL- Returns:
- the iCalendar document, or a 404
-