Search in sources :

Example 1 with EnvConfiguration

use of org.eclipse.jetty.plus.webapp.EnvConfiguration in project jetty.project by eclipse.

the class WSServer method createWebAppContext.

public WebAppContext createWebAppContext() throws MalformedURLException, IOException {
    WebAppContext context = new WebAppContext();
    context.setContextPath(this.contextPath);
    context.setBaseResource(Resource.newResource(this.contextDir));
    context.setAttribute("org.eclipse.jetty.websocket.jsr356", Boolean.TRUE);
    // @formatter:off
    context.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebXmlConfiguration(), new WebInfConfiguration(), new PlusConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(), new EnvConfiguration() });
    return context;
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) WebXmlConfiguration(org.eclipse.jetty.webapp.WebXmlConfiguration) WebInfConfiguration(org.eclipse.jetty.webapp.WebInfConfiguration) MetaInfConfiguration(org.eclipse.jetty.webapp.MetaInfConfiguration) PlusConfiguration(org.eclipse.jetty.plus.webapp.PlusConfiguration) FragmentConfiguration(org.eclipse.jetty.webapp.FragmentConfiguration) AnnotationConfiguration(org.eclipse.jetty.annotations.AnnotationConfiguration) EnvConfiguration(org.eclipse.jetty.plus.webapp.EnvConfiguration)

Example 2 with EnvConfiguration

use of org.eclipse.jetty.plus.webapp.EnvConfiguration in project jetty.project by eclipse.

the class WSServer method createWebAppContext.

public WebAppContext createWebAppContext() throws MalformedURLException, IOException {
    WebAppContext context = new WebAppContext();
    context.setContextPath(this.contextPath);
    context.setBaseResource(Resource.newResource(this.contextDir));
    context.setAttribute("org.eclipse.jetty.websocket.jsr356", Boolean.TRUE);
    // @formatter:off
    context.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebXmlConfiguration(), new WebInfConfiguration(), new PlusConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(), new EnvConfiguration() });
    return context;
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) WebXmlConfiguration(org.eclipse.jetty.webapp.WebXmlConfiguration) WebInfConfiguration(org.eclipse.jetty.webapp.WebInfConfiguration) MetaInfConfiguration(org.eclipse.jetty.webapp.MetaInfConfiguration) PlusConfiguration(org.eclipse.jetty.plus.webapp.PlusConfiguration) FragmentConfiguration(org.eclipse.jetty.webapp.FragmentConfiguration) AnnotationConfiguration(org.eclipse.jetty.annotations.AnnotationConfiguration) EnvConfiguration(org.eclipse.jetty.plus.webapp.EnvConfiguration)

Example 3 with EnvConfiguration

use of org.eclipse.jetty.plus.webapp.EnvConfiguration in project head by mifos.

the class WorkspaceServerLauncher method createWebAppContext.

@Override
protected WebAppContext createWebAppContext() throws Exception {
    final WebContextWithServletContextResourceExtension webAppContext;
    webAppContext = new WebContextWithServletContextResourceExtension(null, "/" + getContext());
    final ResourceCollection baseResources = baseResources();
    if (baseResources != null) {
        // This is if a web.xml
        webAppContext.setBaseResource(baseResources);
    } else {
        // This is if there is no web.xml, only META-INF/resources & web-fragment.xml
        final File tempFileDir = File.createTempFile("jetty-empty-context", Long.toString(System.nanoTime()));
        IO.delete(tempFileDir);
        tempFileDir.mkdirs();
        tempFileDir.deleteOnExit();
        webAppContext.setBaseResource(Resource.newResource(tempFileDir.toURI()));
    }
    webAppContext.replaceConfiguration(MetaInfConfiguration.class, new MetaInfFolderConfiguration());
    webAppContext.replaceConfiguration(FragmentConfiguration.class, new FragmentFolderConfiguration());
    webAppContext.replaceConfiguration(WebInfConfiguration.class, new WebInfFolderExtendedConfiguration());
    //For JNDI
    webAppContext.addConfiguration(new PlusConfiguration());
    webAppContext.addConfiguration(new EnvConfiguration());
    // This will make EVERYTHING on the classpath be
    // scanned for META-INF/resources and web-fragment.xml - great for dev!
    // NOTE: Several patterns can be listed, separate by comma
    webAppContext.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, ".*");
    webAppContext.setAttribute(WebInfConfiguration.WEBINF_JAR_PATTERN, ".*");
    // Needed for http://mifosforge.jira.com/browse/MIFOS-4918
    File tmp = new File("./targetEclipse/jetty-work");
    IO.delete(tmp);
    tmp.mkdirs();
    webAppContext.setTempDirectory(tmp);
    return webAppContext;
}
Also used : PlusConfiguration(org.eclipse.jetty.plus.webapp.PlusConfiguration) File(java.io.File) ResourceCollection(org.eclipse.jetty.util.resource.ResourceCollection) EnvConfiguration(org.eclipse.jetty.plus.webapp.EnvConfiguration)

Aggregations

EnvConfiguration (org.eclipse.jetty.plus.webapp.EnvConfiguration)3 PlusConfiguration (org.eclipse.jetty.plus.webapp.PlusConfiguration)3 AnnotationConfiguration (org.eclipse.jetty.annotations.AnnotationConfiguration)2 FragmentConfiguration (org.eclipse.jetty.webapp.FragmentConfiguration)2 MetaInfConfiguration (org.eclipse.jetty.webapp.MetaInfConfiguration)2 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)2 WebInfConfiguration (org.eclipse.jetty.webapp.WebInfConfiguration)2 WebXmlConfiguration (org.eclipse.jetty.webapp.WebXmlConfiguration)2 File (java.io.File)1 ResourceCollection (org.eclipse.jetty.util.resource.ResourceCollection)1