Package org.opencastproject.kernel.rest
Class RestPublisher
java.lang.Object
org.opencastproject.kernel.rest.RestPublisher
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionclassA custom ServiceTracker that published JAX-RS annotated services with theRestConstants.SERVICE_PATH_PROPERTYproperty set to some non-null value.protected static classExtends the CXF JSONProvider for the grand purpose of removing '@' symbols from json and padded jsonp.static classAn HttpServlet that uses a JAX-RS service to handle requests. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe base URL for this serverprotected org.osgi.util.tracker.BundleTracker<Object> A bundle tracker that registers StaticResource servlets for bundles with the right headers.protected org.osgi.service.component.ComponentContextThe rest publisher's OSGI declarative services component contextstatic final StringThe rest publisher looks for any non-servlet with the 'opencast.service.path' propertyA service tracker that monitors JAX-RS annotated services, (un)publishing servlets as they (dis)appearprotected static final org.slf4j.LoggerThe loggerprotected static final ConcurrentHashMap<String, String> A map that sets default xml namespaces inXMLStreamWritersHolds references to servlets that this class publishes, so they can be unpublished laterFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate(org.osgi.service.component.ComponentContext componentContext) Activates this rest publishervoidbindHttpService(org.osgi.service.http.HttpService httpService) protected voidcreateEndpoint(org.osgi.framework.ServiceReference<?> ref, Object service) Creates a REST endpoint for the JAX-RS annotated service.protected voidDeactivates the rest publisherprotected voiddestroyEndpoint(String alias, Object service) Removes an endpointvoidunbindHttpService(org.osgi.service.http.HttpService httpService)
-
Field Details
-
logger
protected static final org.slf4j.Logger loggerThe logger -
JAX_RS_SERVICE_FILTER
The rest publisher looks for any non-servlet with the 'opencast.service.path' property- See Also:
-
NAMESPACE_MAP
A map that sets default xml namespaces inXMLStreamWriters -
providers
-
componentContext
protected org.osgi.service.component.ComponentContext componentContextThe rest publisher's OSGI declarative services component context -
jaxRsTracker
A service tracker that monitors JAX-RS annotated services, (un)publishing servlets as they (dis)appear -
bundleTracker
A bundle tracker that registers StaticResource servlets for bundles with the right headers. -
baseServerUri
The base URL for this server -
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
Creates a REST endpoint for the JAX-RS annotated service.- Parameters:
ref- the osgi service referenceservice- The service itself
-
destroyEndpoint
Removes an endpoint- Parameters:
alias- The URL space to reclaimservice- The service reference
-