Class ServletRegistry
- java.lang.Object
-
- org.nuxeo.ecm.webengine.jaxrs.servlet.config.ServletRegistry
-
public class ServletRegistry extends Object
Handle servlet registration from Nuxeo extension points. This class is a singleton shared by theActivator
and theServletRegistryComponent
component. Because we don't have yet a solution to synchronize the initialization time of the Activator and a Nuxeo component we are using a singleton instance to be able- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.Bundle
bundle
The bundle owning this classprotected Map<String,BundleHttpContext>
contexts
The registered HttpContext mapped to the servlet path.protected List<FilterSetDescriptor>
filters
protected Map<String,List<ResourcesDescriptor>>
resources
Store resources contributed from external bundles to servlets.protected org.osgi.service.http.HttpService
service
The HttpService instance is injected when the service becomes available by the Activator.static String
SERVLET_NAME
protected List<ServletDescriptor>
servlets
Servlets contributed to the extension points.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFilterSet(FilterSetDescriptor filter)
void
addResources(ResourcesDescriptor rd)
void
addServlet(ServletDescriptor descriptor)
static void
dispose()
FilterSetDescriptor[]
getFilterSetDescriptors()
List<FilterSetDescriptor>
getFiltersFor(String name)
org.osgi.service.http.HttpService
getHttpService()
static ServletRegistry
getInstance()
ServletDescriptor
getServletDescriptor(String name)
ServletDescriptor[]
getServletDescriptors()
void
initHttpService(org.osgi.service.http.HttpService service)
Called by the service tracker when HttpService is up to configure it with current contributed servletsvoid
reloadServlet(ServletDescriptor descriptor)
void
removeFilterSet(FilterSetDescriptor filter)
void
removeResources(ResourcesDescriptor rd)
void
removeServlet(ServletDescriptor descriptor)
-
-
-
Field Detail
-
SERVLET_NAME
public static final String SERVLET_NAME
-
servlets
protected List<ServletDescriptor> servlets
Servlets contributed to the extension points. Servlets are contributed to theHttpService
when it becomes available.
-
filters
protected List<FilterSetDescriptor> filters
-
resources
protected Map<String,List<ResourcesDescriptor>> resources
Store resources contributed from external bundles to servlets. Map the servlet path to the list of contributed resources
-
contexts
protected Map<String,BundleHttpContext> contexts
The registered HttpContext mapped to the servlet path. An HttpContext is created and inserted in this map when its servlet is registered against the HttpService. The context is removed when the servlet is unregsitered.Resource contributions are injected into the context and reinjected each time the context is restarted.
-
service
protected org.osgi.service.http.HttpService service
The HttpService instance is injected when the service becomes available by the Activator.
-
bundle
protected org.osgi.framework.Bundle bundle
The bundle owning this class
-
-
Method Detail
-
getInstance
public static ServletRegistry getInstance()
-
dispose
public static void dispose()
-
getServletDescriptors
public ServletDescriptor[] getServletDescriptors()
-
getFilterSetDescriptors
public FilterSetDescriptor[] getFilterSetDescriptors()
-
getServletDescriptor
public ServletDescriptor getServletDescriptor(String name)
-
getFiltersFor
public List<FilterSetDescriptor> getFiltersFor(String name)
-
initHttpService
public void initHttpService(org.osgi.service.http.HttpService service) throws javax.servlet.ServletException, org.osgi.service.http.NamespaceException
Called by the service tracker when HttpService is up to configure it with current contributed servlets- Throws:
javax.servlet.ServletException
org.osgi.service.http.NamespaceException
-
getHttpService
public org.osgi.service.http.HttpService getHttpService()
-
addServlet
public void addServlet(ServletDescriptor descriptor) throws javax.servlet.ServletException, org.osgi.service.http.NamespaceException
- Throws:
javax.servlet.ServletException
org.osgi.service.http.NamespaceException
-
removeServlet
public void removeServlet(ServletDescriptor descriptor)
-
reloadServlet
public void reloadServlet(ServletDescriptor descriptor) throws javax.servlet.ServletException, org.osgi.service.http.NamespaceException
- Throws:
javax.servlet.ServletException
org.osgi.service.http.NamespaceException
-
addFilterSet
public void addFilterSet(FilterSetDescriptor filter)
-
removeFilterSet
public void removeFilterSet(FilterSetDescriptor filter)
-
addResources
public void addResources(ResourcesDescriptor rd)
-
removeResources
public void removeResources(ResourcesDescriptor rd)
-
-