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 the Activator and the ServletRegistryComponent 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 Details

    • SERVLET_NAME

      public static final String SERVLET_NAME
    • servlets

      protected List<ServletDescriptor> servlets
      Servlets contributed to the extension points. Servlets are contributed to the HttpService 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 Details

    • 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)