Package org.opencastproject.playlists
Class PlaylistRestService
java.lang.Object
org.opencastproject.playlists.PlaylistRestService
A REST endpoint for the
PlaylistService-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorizationServiceThe authorization servicestatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected SearchServiceThe search service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Responsejavax.ws.rs.core.ResponseaddEntry(String playlistId, String contentId, PlaylistEntryType type) javax.ws.rs.core.ResponsecreateAsJson(String playlistText) javax.ws.rs.core.ResponsecreateAsXml(String playlistText) javax.ws.rs.core.ResponsegetPlaylistAsJson(String id, boolean withPublications) javax.ws.rs.core.ResponsegetPlaylistAsXml(String id, boolean withPublications) javax.ws.rs.core.ResponsegetPlaylistsAsJson(int limit, int offset, String sort) javax.ws.rs.core.ResponsegetPlaylistsAsXml(int limit, int offset, String sort) parseJsonToPlaylist(String json) While jackson takes care of automatically converting JAXB to JSON when returning from a request, getting it to parse JSON to JAXB when accepting a request is not that automatic.javax.ws.rs.core.ResponsevoidsetAuthorizationService(AuthorizationService authorizationService) protected voidsetSearchService(SearchService searchService) voidsetService(PlaylistService service) Sets the playlist servicejavax.ws.rs.core.ResponseupdateAsJson(String id, String playlistText) javax.ws.rs.core.ResponseupdateAsXml(String id, String playlistText)
-
Field Details
-
SAMPLE_PLAYLIST_JSON
- See Also:
-
SAMPLE_PLAYLIST_ENTRIES_JSON
- See Also:
-
SAMPLE_PLAYLIST_XML
- See Also:
-
SAMPLE_PLAYLIST_ENTRIES_XML
- See Also:
-
searchService
The search service -
authorizationService
The authorization service
-
-
Constructor Details
-
PlaylistRestService
public PlaylistRestService()
-
-
Method Details
-
setService
Sets the playlist service- Parameters:
service- the playlist service instance
-
setSearchService
-
setAuthorizationService
-
getPlaylistAsJson
@GET @Produces("application/json") @Path("{id}.json") public javax.ws.rs.core.Response getPlaylistAsJson(@PathParam("id") String id, @FormParam("withPublications") boolean withPublications) throws NotFoundException, UnauthorizedException -
getPlaylistAsXml
@GET @Produces("application/xml") @Path("{id}.xml") public javax.ws.rs.core.Response getPlaylistAsXml(@PathParam("id") String id, @FormParam("withPublications") boolean withPublications) throws NotFoundException, UnauthorizedException -
getPlaylistsAsJson
@GET @Produces("application/json") @Path("playlists.json") public javax.ws.rs.core.Response getPlaylistsAsJson(@FormParam("limit") int limit, @FormParam("offset") int offset, @FormParam("sort") String sort) throws NotFoundException - Throws:
NotFoundException
-
getPlaylistsAsXml
@GET @Produces("application/xml") @Path("playlists.xml") public javax.ws.rs.core.Response getPlaylistsAsXml(@FormParam("limit") int limit, @FormParam("offset") int offset, @FormParam("sort") String sort) throws NotFoundException - Throws:
NotFoundException
-
createAsJson
@POST @Produces("application/json") @Path("new.json") public javax.ws.rs.core.Response createAsJson(@FormParam("playlist") String playlistText) throws UnauthorizedException - Throws:
UnauthorizedException
-
createAsXml
@POST @Produces("application/xml") @Path("new.xml") public javax.ws.rs.core.Response createAsXml(@FormParam("playlist") String playlistText) throws UnauthorizedException - Throws:
UnauthorizedException
-
updateAsJson
@PUT @Produces("application/json") @Path("{id}.json") public javax.ws.rs.core.Response updateAsJson(@PathParam("id") String id, @FormParam("playlist") String playlistText) throws UnauthorizedException - Throws:
UnauthorizedException
-
updateAsXml
@PUT @Produces("application/xml") @Path("{id}.xml") public javax.ws.rs.core.Response updateAsXml(@PathParam("id") String id, @FormParam("playlist") String playlistText) throws UnauthorizedException - Throws:
UnauthorizedException
-
remove
@DELETE @Produces("application/json") @Path("{id}") public javax.ws.rs.core.Response remove(@PathParam("id") String id) throws NotFoundException, UnauthorizedException -
addEntry
@POST @Produces("application/json") @Path("{id}/entries/new") public javax.ws.rs.core.Response addEntry(@PathParam("id") String playlistId, @FormParam("contentId") String contentId, @FormParam("type") PlaylistEntryType type) throws NotFoundException, UnauthorizedException -
addEntry
@POST @Produces("application/json") @Path("{id}/entries/{entryId}") public javax.ws.rs.core.Response addEntry(@PathParam("id") String playlistId, @PathParam("entryId") Long entryId) throws NotFoundException, UnauthorizedException -
parseJsonToPlaylist
public Playlist parseJsonToPlaylist(String json) throws org.json.simple.parser.ParseException, IOException While jackson takes care of automatically converting JAXB to JSON when returning from a request, getting it to parse JSON to JAXB when accepting a request is not that automatic. This functions takes care of that.- Parameters:
json- Valid JSON as a string- Returns:
- A Playlist containing the information from the JSON
- Throws:
org.json.simple.parser.ParseExceptionIOException
-