Class JasperInitializer
- java.lang.Object
-
- org.apache.jasper.servlet.JasperInitializer
-
- org.ops4j.pax.web.jsp.JasperInitializer
-
- All Implemented Interfaces:
javax.servlet.ServletContainerInitializer
public class JasperInitializer extends org.apache.jasper.servlet.JasperInitializerPax Web extends original initializer, so it is possible to override the
TldScanner.This initializer is declared in
/META-INF/services/javax.servlet.ServletContainerInitializerfor pax-web-extender-war purpose. For Whiteboard and HttpService purposes, it is used directly to configure the context(s) when JSP support is required.According to Servlet specification 8.3 "JSP container pluggability", JSP processing/parsing/setup is no longer performed by "Servlet container" itself and instead can be delegated to "JSP container" using
ServletContainerInitializermechanism.Neither Whiteboard (CMPN 140) nor HttpService (CMPN 102) specifications say anything about JSPs. The only relevant specification is "128 Web Applications Specification" which defines WABs (Web Application Bundles), but there is not many details about how exactly JSPs (and TLDs) should be supported.
So we start with the asumption that CMPN 128 specification is about supporting WARs in OSGi runtime in very similar way to how they work in JavaEE environments. The most important common ground is how to use classloaders to find necessary resources. Details of how TLDs should be located are described inline below. Here's the outline: in JavaEE, WAR is associated with single classloader, which includes:
/WEB-INF/classesdirectory- each of the
/WEN-INF/lib/*.jar
ServletContextHelper(HttpContext), which are customized internally intoOsgiContextModel. These can be mixed in many ways with dynamic servlets, filters and other web elements. However, when we finally get to pax-web-extender-war, we have to marks some instance ofOsgiContextModelas a context associated with WAB/WAR.Because there should be no such thing as classpath in OSGi application (only a mesh of bundles), an entry point to searching for TLDs should be a bundle. When this initializer is being passed an
OsgiServletContext(associated with singleOsgiContextModel) we'll get the owner bundle of such context (model). If it's a different implementation ofServletContextwe'll look forosgi-bundlecontextcontext attribute according to "128.6.1 Bundle Context Access". When there's no such attribute, we'll explicitly do nothing.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description JasperInitializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jasper.servlet.TldScannernewTldScanner(javax.servlet.ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal)voidonStartup(Set<Class<?>> types, javax.servlet.ServletContext context)
-
-
-
Method Detail
-
onStartup
public void onStartup(Set<Class<?>> types, javax.servlet.ServletContext context) throws javax.servlet.ServletException
- Specified by:
onStartupin interfacejavax.servlet.ServletContainerInitializer- Overrides:
onStartupin classorg.apache.jasper.servlet.JasperInitializer- Throws:
javax.servlet.ServletException
-
newTldScanner
protected org.apache.jasper.servlet.TldScanner newTldScanner(javax.servlet.ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal)- Overrides:
newTldScannerin classorg.apache.jasper.servlet.JasperInitializer
-
-