Search in sources :

Example 6 with ServletContainerInitializersStarter

use of org.eclipse.jetty.annotations.ServletContainerInitializersStarter in project oozie by apache.

the class JspHandler method setupWebAppContext.

/**
 * Setup the basic application "context" for this application at "/"
 * This is also known as the handler tree (in jetty speak)
 * @param servletContextHandler the context handler
 * @throws IOException in case of IO errors
 * @throws URISyntaxException if the server URI is not well formatted
 */
public void setupWebAppContext(WebAppContext servletContextHandler) throws IOException, URISyntaxException {
    Preconditions.checkNotNull(servletContextHandler, "servletContextHandler is null");
    File scratchDir = getScratchDir();
    servletContextHandler.setAttribute("javax.servlet.context.tempdir", scratchDir);
    servletContextHandler.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/.*taglibs.*\\.jar$");
    URI baseUri = webRootResourceLocator.getWebRootResourceUri();
    servletContextHandler.setResourceBase(baseUri.toASCIIString());
    servletContextHandler.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
    servletContextHandler.addBean(new ServletContainerInitializersStarter(servletContextHandler), true);
    servletContextHandler.setClassLoader(getUrlClassLoader());
    servletContextHandler.addServlet(jspServletHolder(), "*.jsp");
    servletContextHandler.addServlet(jspFileMappedServletHolder(), "/oozie/");
    servletContextHandler.addServlet(defaultServletHolder(baseUri), "/");
}
Also used : ServletContainerInitializersStarter(org.eclipse.jetty.annotations.ServletContainerInitializersStarter) File(java.io.File) URI(java.net.URI)

Aggregations

ServletContainerInitializersStarter (org.eclipse.jetty.annotations.ServletContainerInitializersStarter)6 InstanceManager (org.apache.tomcat.InstanceManager)3 SimpleInstanceManager (org.apache.tomcat.SimpleInstanceManager)3 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)2 File (java.io.File)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AnnotationDecorator (org.eclipse.jetty.annotations.AnnotationDecorator)1 ContainerInitializer (org.eclipse.jetty.plus.annotation.ContainerInitializer)1 ContextHandler (org.eclipse.jetty.server.handler.ContextHandler)1 Resource (org.eclipse.jetty.util.resource.Resource)1 StandardDescriptorProcessor (org.eclipse.jetty.webapp.StandardDescriptorProcessor)1 WebAppClassLoader (org.eclipse.jetty.webapp.WebAppClassLoader)1