Class JspServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class JspServlet
    extends javax.servlet.http.HttpServlet

    JSPServlet wraps the Apache Jasper Servlet making it appropriate for running in an OSGi environment under the Http Service. The Jasper JSPServlet makes use of the Thread Context Classloader to support compile and runtime of JSPs and to accommodate running in an OSGi environment, a Bundle is used to provide the similar context normally provided by the webapp.

    The Jasper Servlet will search the ServletContext to find JSPs, tag library descriptors, and additional information in the web.xml as per the JSP 2.0 specification. In addition to the ServletContext this implementation will search the bundle (but not attached fragments) for matching resources in a manner consistent with the Http Service's notion of a resource. By using alias and bundleResourcePath the JSP lookup should be in line with the resource mapping specified in {102.4} of the OSGi HttpService.

    TLD discovery is slightly different, to clarify it occurs in one of three ways:

    1. declarations found in /WEB-INF/web.xml (found either on the bundleResourcePath in the bundle or in the ServletContext)
    2. tld files found under /WEB-INF (found either on the bundleResourcePath in the bundle or in the ServletContext)
    3. tld files found in jars on the Bundle-Classpath (see org.eclipse.equinox.internal.jsp.jasper.JSPClassLoader)

    Other than the setting and resetting of the thread context classloader and additional resource lookups in the bundle the JSPServlet is behaviourally consistent with the JSP 2.0 specification and regular Jasper operation.

    See Also:
    Serialized Form
    Restriction:
    This class is not intended to be subclassed by clients.
    • Constructor Detail

      • JspServlet

        public JspServlet​(Bundle bundle,
                          String bundleResourcePath,
                          String alias)
      • JspServlet

        public JspServlet​(Bundle bundle,
                          String bundleResourcePath)
    • Method Detail

      • init

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

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class javax.servlet.GenericServlet
      • service

        public void service​(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws javax.servlet.ServletException,
                            IOException
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • getServletConfig

        public javax.servlet.ServletConfig getServletConfig()
        Specified by:
        getServletConfig in interface javax.servlet.Servlet
        Overrides:
        getServletConfig in class javax.servlet.GenericServlet
      • getServletInfo

        public String getServletInfo()
        Specified by:
        getServletInfo in interface javax.servlet.Servlet
        Overrides:
        getServletInfo in class javax.servlet.GenericServlet