Class 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 Detail

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

      • dispose

        public static void dispose()
      • 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
      • reloadServlet

        public void reloadServlet​(ServletDescriptor descriptor)
                           throws javax.servlet.ServletException,
                                  org.osgi.service.http.NamespaceException
        Throws:
        javax.servlet.ServletException
        org.osgi.service.http.NamespaceException