Package org.opencastproject.playlists
Class PlaylistRestService
java.lang.Object
org.opencastproject.playlists.PlaylistRestService
A REST endpoint for the
PlaylistService-
Field Summary
Fields -
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(org.opencastproject.security.api.AuthorizationService authorizationService) protected voidsetSearchService(org.opencastproject.search.api.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
protected org.opencastproject.search.api.SearchService searchServiceThe search service -
authorizationService
protected org.opencastproject.security.api.AuthorizationService authorizationServiceThe authorization service
-
-
Constructor Details
-
PlaylistRestService
public PlaylistRestService()
-
-
Method Details
-
setService
Sets the playlist service- Parameters:
service- the playlist service instance
-
setSearchService
protected void setSearchService(org.opencastproject.search.api.SearchService searchService) -
setAuthorizationService
public void setAuthorizationService(org.opencastproject.security.api.AuthorizationService authorizationService) -
getPlaylistAsJson
@GET @Produces("application/json") @Path("{id}.json") public javax.ws.rs.core.Response getPlaylistAsJson(@PathParam("id") String id, @FormParam("withPublications") boolean withPublications) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.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 org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.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 org.opencastproject.util.NotFoundException - Throws:
org.opencastproject.util.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 org.opencastproject.util.NotFoundException - Throws:
org.opencastproject.util.NotFoundException
-
createAsJson
@POST @Produces("application/json") @Path("new.json") public javax.ws.rs.core.Response createAsJson(@FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.security.api.UnauthorizedException
-
createAsXml
@POST @Produces("application/xml") @Path("new.xml") public javax.ws.rs.core.Response createAsXml(@FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.security.api.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 org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.security.api.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 org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.security.api.UnauthorizedException
-
remove
@DELETE @Produces("application/json") @Path("{id}") public javax.ws.rs.core.Response remove(@PathParam("id") String id) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.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 org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.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 org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException - Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.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
-