Class RestPublisher

java.lang.Object
org.opencastproject.kernel.rest.RestPublisher
All Implemented Interfaces:
org.opencastproject.rest.RestConstants

public class RestPublisher extends Object implements org.opencastproject.rest.RestConstants
Listens for JAX-RS annotated services and publishes them to the global URL space using a single shared HttpContext.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    A custom ServiceTracker that published JAX-RS annotated services with the RestConstants.SERVICE_PATH_PROPERTY property set to some non-null value.
    protected static class 
    Extends the CXF JSONProvider for the grand purpose of removing '@' symbols from json and padded jsonp.
    static class 
    An HttpServlet that uses a JAX-RS service to handle requests.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    The base URL for this server
    protected org.osgi.util.tracker.BundleTracker<Object>
    A bundle tracker that registers StaticResource servlets for bundles with the right headers.
    protected org.osgi.service.component.ComponentContext
    The rest publisher's OSGI declarative services component context
    static final String
    The rest publisher looks for any non-servlet with the 'opencast.service.path' property
    protected org.osgi.util.tracker.ServiceTracker<Object,Object>
    A service tracker that monitors JAX-RS annotated services, (un)publishing servlets as they (dis)appear
    protected static final org.slf4j.Logger
    The logger
    protected static final ConcurrentHashMap<String,String>
    A map that sets default xml namespaces in XMLStreamWriters
    protected List<Object>
     
    protected Map<String,org.osgi.framework.ServiceRegistration<?>>
    Holds references to servlets that this class publishes, so they can be unpublished later

    Fields inherited from interface org.opencastproject.rest.RestConstants

    HTTP_ALIAS, HTTP_CLASSPATH, HTTP_CONTEXT_ID, HTTP_SPA_REDIRECT, HTTP_WELCOME, MAX_INACTIVE_INTERVAL, SERVICE_JOBPRODUCER_PROPERTY, SERVICE_PATH_PROPERTY, SERVICE_PUBLISH_PROPERTY, SERVICE_TYPE_PROPERTY, SERVICES_FILTER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    activate(org.osgi.service.component.ComponentContext componentContext)
    Activates this rest publisher
    void
    bindHttpService(org.osgi.service.http.HttpService httpService)
     
    protected void
    createEndpoint(org.osgi.framework.ServiceReference<?> ref, Object service)
    Creates a REST endpoint for the JAX-RS annotated service.
    protected void
    Deactivates the rest publisher
    protected void
    destroyEndpoint(String alias, Object service)
    Removes an endpoint
    void
    unbindHttpService(org.osgi.service.http.HttpService httpService)
     

    Methods inherited from class java.lang.Object

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

    • logger

      protected static final org.slf4j.Logger logger
      The logger
    • JAX_RS_SERVICE_FILTER

      public static final String JAX_RS_SERVICE_FILTER
      The rest publisher looks for any non-servlet with the 'opencast.service.path' property
      See Also:
    • NAMESPACE_MAP

      protected static final ConcurrentHashMap<String,String> NAMESPACE_MAP
      A map that sets default xml namespaces in XMLStreamWriters
    • providers

      protected List<Object> providers
    • componentContext

      protected org.osgi.service.component.ComponentContext componentContext
      The rest publisher's OSGI declarative services component context
    • jaxRsTracker

      protected org.osgi.util.tracker.ServiceTracker<Object,Object> jaxRsTracker
      A service tracker that monitors JAX-RS annotated services, (un)publishing servlets as they (dis)appear
    • bundleTracker

      protected org.osgi.util.tracker.BundleTracker<Object> bundleTracker
      A bundle tracker that registers StaticResource servlets for bundles with the right headers.
    • baseServerUri

      protected String baseServerUri
      The base URL for this server
    • servletRegistrationMap

      protected Map<String,org.osgi.framework.ServiceRegistration<?>> servletRegistrationMap
      Holds references to servlets that this class publishes, so they can be unpublished later
  • Constructor Details

    • RestPublisher

      public RestPublisher()
  • Method Details

    • activate

      protected void activate(org.osgi.service.component.ComponentContext componentContext)
      Activates this rest publisher
    • deactivate

      protected void deactivate()
      Deactivates the rest publisher
    • bindHttpService

      public void bindHttpService(org.osgi.service.http.HttpService httpService)
    • unbindHttpService

      public void unbindHttpService(org.osgi.service.http.HttpService httpService)
    • createEndpoint

      protected void createEndpoint(org.osgi.framework.ServiceReference<?> ref, Object service)
      Creates a REST endpoint for the JAX-RS annotated service.
      Parameters:
      ref - the osgi service reference
      service - The service itself
    • destroyEndpoint

      protected void destroyEndpoint(String alias, Object service)
      Removes an endpoint
      Parameters:
      alias - The URL space to reclaim
      service - The service reference