Class StaticFileRestService

java.lang.Object
org.opencastproject.staticfiles.endpoint.StaticFileRestService

@Path("/staticfiles") public class StaticFileRestService extends Object
Stores and serves static files via HTTP.
  • Field Details

    • STATICFILES_URL_PATH

      public static final String STATICFILES_URL_PATH
      The default URL path of the static files
      See Also:
    • STATICFILES_WEBSERVER_ENABLED_KEY

      public static final String STATICFILES_WEBSERVER_ENABLED_KEY
      The key to find whether the static file webserver is enabled or not.
      See Also:
    • STATICFILES_WEBSERVER_URL_KEY

      public static final String STATICFILES_WEBSERVER_URL_KEY
      The key to find the URL for where a webserver is hosting the static files.
      See Also:
    • STATICFILES_UPLOAD_MAX_SIZE_KEY

      public static final String STATICFILES_UPLOAD_MAX_SIZE_KEY
      The key to find the maximum sized file to accept as an upload.
      See Also:
    • useWebserver

      protected boolean useWebserver
      Whether to provide urls to download the static files from a webserver without organization and security protection, or use Opencast to provide the files.
  • Constructor Details

    • StaticFileRestService

      public StaticFileRestService()
  • Method Details

    • setStaticFileService

      public void setStaticFileService(StaticFileService staticFileService)
      OSGi callback to bind service instance.
    • setSecurityService

      public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
      OSGi callback to bind service instance.
    • activate

      public void activate(org.osgi.service.component.ComponentContext cc) throws org.osgi.service.cm.ConfigurationException
      OSGI callback for activating this component
      Parameters:
      cc - the osgi component context
      Throws:
      org.osgi.service.cm.ConfigurationException
    • getStaticFile

      @GET @Path("{uuid}") public javax.ws.rs.core.Response getStaticFile(@PathParam("uuid") String uuid) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • postStaticFile

      @POST @Consumes("multipart/form-data") @Produces("text/plain") @Path("") public javax.ws.rs.core.Response postStaticFile(@Context javax.servlet.http.HttpServletRequest request)
    • persistFile

      @POST @Path("{uuid}/persist") public javax.ws.rs.core.Response persistFile(@PathParam("uuid") String uuid) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • getStaticFileUrl

      @GET @Produces("text/plain") @Path("{uuid}/url") public javax.ws.rs.core.Response getStaticFileUrl(@PathParam("uuid") String uuid) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • deleteStaticFile

      @DELETE @Path("{uuid}") public javax.ws.rs.core.Response deleteStaticFile(@PathParam("uuid") String uuid) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • getStaticFileURL

      public URI getStaticFileURL(String uuid) throws org.opencastproject.util.NotFoundException
      Get the URI for a static file resource depending on whether to get it direct from Opencast or from a webserver.
      Parameters:
      uuid - The unique identifier for the static file.
      Returns:
      The URL for the static file resource.
      Throws:
      org.opencastproject.util.NotFoundException - if the resource couldn't been found