Class BridgeServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
    Direct Known Subclasses:
    BridgeFilter

    public class BridgeServlet
    extends javax.servlet.http.HttpServlet
    Adapted from org.eclipse.equinox.servletbridge.BridgeServlet The BridgeServlet provides a means to bridge the servlet and OSGi runtimes. This class has 3 main responsibilities: 1) Control the lifecycle of the associated FrameworkLauncher in line with its own lifecycle 2) Provide a servlet "hook" that allows all servlet requests to be delegated to the registered servlet 3) Provide means to manually control the framework lifecycle
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      BridgeServlet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()
      destroy() is called by the Servlet Container and used to first stop and then destroy the framework.
      void init()
      init() is called by the Servlet Container and used to instantiate the frameworkLauncher which MUST be an instance of FrameworkLauncher.
      protected void process​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, javax.servlet.FilterChain chain)
      Search from OSGi registry the servlet, ressources... to executed according the path of the HTTP request.
      protected void service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      service is called by the Servlet Container and will first determine if the request is a framework control and will otherwise try to delegate to the registered servlet delegate
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
      • Methods inherited from class javax.servlet.GenericServlet

        getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
    • Constructor Detail

      • BridgeServlet

        public BridgeServlet()
    • Method Detail

      • init

        public void init()
                  throws javax.servlet.ServletException
        init() is called by the Servlet Container and used to instantiate the frameworkLauncher which MUST be an instance of FrameworkLauncher. After instantiating the framework init, deploy, and start are called.
        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException
      • destroy

        public void destroy()
        destroy() is called by the Servlet Container and used to first stop and then destroy the framework.
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class javax.servlet.GenericServlet
      • service

        protected void service​(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp)
                        throws javax.servlet.ServletException,
                               IOException
        service is called by the Servlet Container and will first determine if the request is a framework control and will otherwise try to delegate to the registered servlet delegate
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • process

        protected void process​(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp,
                               javax.servlet.FilterChain chain)
                        throws javax.servlet.ServletException,
                               IOException
        Search from OSGi registry the servlet, ressources... to executed according the path of the HTTP request. If no service are founded :
        • if FilterChain is not null : FilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) is called.
        • otherwise throw 404 error.
        Parameters:
        req -
        resp -
        chain -
        Throws:
        javax.servlet.ServletException
        IOException