Class DynamicServletWrapper

  • All Implemented Interfaces:
    DynamicServlet, javax.servlet.Servlet

    public class DynamicServletWrapper
    extends Object
    implements DynamicServlet
    A simple wrapper to provide DynamicServlet for a HttpServlet. This class forwards all calls, the name can be overridden, notifications for a servlet being (un)deployed are ignored.
    • Field Detail

      • servletName

        protected String servletName
        The name of the servlet or null in case it should be retrieved from the wrapped servlet.
      • servlet

        protected final javax.servlet.http.HttpServlet servlet
        The wrapped servlet.
    • Constructor Detail

      • DynamicServletWrapper

        public DynamicServletWrapper​(String servletName,
                                     javax.servlet.http.HttpServlet servlet)
        Creates a new wrapper for the designated servlet.
        Parameters:
        servletName - The name of the servlet or null in case it should be retrieved from the designated servlet.
        servlet - The wrapped servlet.
    • Method Detail

      • init

        public void init​(javax.servlet.ServletConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Throws:
        javax.servlet.ServletException
      • getServletConfig

        public javax.servlet.ServletConfig getServletConfig()
        Specified by:
        getServletConfig in interface javax.servlet.Servlet
      • service

        public void service​(javax.servlet.ServletRequest req,
                            javax.servlet.ServletResponse res)
                     throws javax.servlet.ServletException,
                            IOException
        Specified by:
        service in interface javax.servlet.Servlet
        Throws:
        javax.servlet.ServletException
        IOException
      • getServletInfo

        public String getServletInfo()
        Specified by:
        getServletInfo in interface javax.servlet.Servlet
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Servlet
      • getServletName

        public String getServletName()
        Description copied from interface: DynamicServlet
        Gets the name of the servlet. Note that usually the servlet implementations rely on the servlet configuration to provide a name. However, when using a DynamicServlet, the servlet name has to be provided explicitly.
        Specified by:
        getServletName in interface DynamicServlet
        Returns:
        The name of the servlet.
      • servletDeployed

        public void servletDeployed​(javax.servlet.ServletContext context,
                                    String urlPattern)
        Description copied from interface: DynamicServlet
        Notifies the servlet that it has been deployed with the designated context and the designated pattern. Note that the servlet usually will not have been initialised yet.
        Specified by:
        servletDeployed in interface DynamicServlet
        Parameters:
        context - The servlet context of this servlet.
        urlPattern - The URL pattern (mapping) this servlet has been deployed with.
      • servletUndeployed

        public void servletUndeployed​(javax.servlet.ServletContext context)
        Description copied from interface: DynamicServlet
        Notifies the servlet that it has been undeployed.
        Specified by:
        servletUndeployed in interface DynamicServlet
        Parameters:
        context - The servlet context of this servlet.