当前位置: 首页>>代码示例>>Java>>正文


Java WebInfConfiguration类代码示例

本文整理汇总了Java中org.eclipse.jetty.webapp.WebInfConfiguration的典型用法代码示例。如果您正苦于以下问题:Java WebInfConfiguration类的具体用法?Java WebInfConfiguration怎么用?Java WebInfConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WebInfConfiguration类属于org.eclipse.jetty.webapp包,在下文中一共展示了WebInfConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureWebAppContext

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
/**
 * Setups the web application context.
 * 
 * @throws IOException
 * @throws Exception
 */
protected void configureWebAppContext(final WebContextWithExtraConfigurations context) throws Exception {
	context.setAttribute("javax.servlet.context.tempdir", getScratchDir());
	// Set the ContainerIncludeJarPattern so that jetty examines these
	// container-path jars for tlds, web-fragments etc.
	// If you omit the jar that contains the jstl .tlds, the jsp engine will
	// scan for them instead.
	context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
			".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");
	context.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
	context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
	context.addBean(new ServletContainerInitializersStarter(context), true);
	// context.setClassLoader(getUrlClassLoader());

	context.addServlet(jspServletHolder(), "*.jsp");
	context.replaceConfiguration(WebInfConfiguration.class, WebInfConfigurationHomeUnpacked.class);
}
 
开发者ID:logsniffer,项目名称:logsniffer,代码行数:23,代码来源:JettyLauncher.java

示例2: main

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	int port = 8080;
	Server server = new Server(port);
	

	WebAppContext context = new WebAppContext();
       context.setWar("./src/main/webapp");
	context.setConfigurations(new Configuration[] {
			new AnnotationConfiguration(), new WebXmlConfiguration(),
			new WebInfConfiguration(), new TagLibConfiguration(),
			new PlusConfiguration(), new MetaInfConfiguration(),
			new FragmentConfiguration(), new EnvConfiguration() });

	context.setContextPath("/");
	context.setParentLoaderPriority(true);
	server.setHandler(context);
	server.start();
	server.dump(System.err);
	server.join();
}
 
开发者ID:extrema,项目名称:jetty-embedded,代码行数:21,代码来源:EmbedMe.java

示例3: createWebAppContext

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
WebAppContext createWebAppContext() throws IOException, SAXException, ClassNotFoundException, UnavailableException {
    webAppContext = new WebAppContext();
    webAppContext.setDefaultsDescriptor(GoWebXmlConfiguration.configuration(getWarFile()));

    webAppContext.setConfigurationClasses(new String[]{
            WebInfConfiguration.class.getCanonicalName(),
            WebXmlConfiguration.class.getCanonicalName(),
            JettyWebXmlConfiguration.class.getCanonicalName()
    });
    webAppContext.setContextPath(systemEnvironment.getWebappContextPath());

    // delegate all logging to parent classloader to avoid initialization of loggers in multiple classloaders
    webAppContext.addSystemClass("org.apache.log4j.");
    webAppContext.addSystemClass("org.slf4j.");
    webAppContext.addSystemClass("org.apache.commons.logging.");

    webAppContext.setWar(getWarFile());
    webAppContext.setParentLoaderPriority(systemEnvironment.getParentLoaderPriority());
    return webAppContext;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:21,代码来源:Jetty9Server.java

示例4: shouldAddWebAppContextHandler

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
@Test
public void shouldAddWebAppContextHandler() throws Exception {
    ArgumentCaptor<HandlerCollection> captor = ArgumentCaptor.forClass(HandlerCollection.class);
    jetty9Server.configure();

    verify(server, times(1)).setHandler(captor.capture());
    HandlerCollection handlerCollection = captor.getValue();
    assertThat(handlerCollection.getHandlers().length, is(3));

    Handler handler = handlerCollection.getHandlers()[2];
    assertThat(handler instanceof WebAppContext, is(true));
    WebAppContext webAppContext = (WebAppContext) handler;
    List<String> configClasses = new ArrayList<>(Arrays.asList(webAppContext.getConfigurationClasses()));
    assertThat(configClasses.contains(WebInfConfiguration.class.getCanonicalName()), is(true));
    assertThat(configClasses.contains(WebXmlConfiguration.class.getCanonicalName()), is(true));
    assertThat(configClasses.contains(JettyWebXmlConfiguration.class.getCanonicalName()), is(true));
    assertThat(webAppContext.getContextPath(), is("context"));
    assertThat(webAppContext.getWar(), is("cruise.war"));
    assertThat(webAppContext.isParentLoaderPriority(), is(true));
    assertThat(webAppContext.getDefaultsDescriptor(), is("jar:file:cruise.war!/WEB-INF/webdefault.xml"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:22,代码来源:Jetty9ServerTest.java

示例5: createControlledBounceproxyWebApp

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
public static WebAppContext createControlledBounceproxyWebApp(String parentContext, Properties props) {
    WebAppContext bounceproxyWebapp = new WebAppContext();
    bounceproxyWebapp.setContextPath(createContextPath(parentContext, BOUNCEPROXY_CONTEXT));
    bounceproxyWebapp.setWar("target/controlled-bounceproxy.war");

    if (props != null) {
        bounceproxyWebapp.setConfigurations(new Configuration[]{ new WebInfConfiguration(),
                new WebXmlConfiguration(), new SystemPropertyServletConfiguration(props) });
    }

    // Makes jetty load classes in the same order as JVM. Otherwise there's
    // a conflict loading loggers.
    bounceproxyWebapp.setParentLoaderPriority(true);

    return bounceproxyWebapp;
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:17,代码来源:ServersUtil.java

示例6: createBounceproxyControllerWebApp

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
public static WebAppContext createBounceproxyControllerWebApp(String warFileName,
                                                              String parentContext,
                                                              Properties props) {
    WebAppContext bounceproxyWebapp = new WebAppContext();
    bounceproxyWebapp.setContextPath(createContextPath(parentContext, BOUNCEPROXYCONTROLLER_CONTEXT));
    bounceproxyWebapp.setWar("target/" + warFileName + ".war");

    if (props != null) {
        bounceproxyWebapp.setConfigurations(new Configuration[]{ new WebInfConfiguration(),
                new WebXmlConfiguration(), new SystemPropertyServletConfiguration(props) });
    }
    // Makes jetty load classes in the same order as JVM. Otherwise there's
    // a conflict loading loggers.
    bounceproxyWebapp.setParentLoaderPriority(true);

    return bounceproxyWebapp;
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:18,代码来源:ServersUtil.java

示例7: start

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
public void start() throws Exception {
    server = new Server(8080);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setResourceBase("src/main/webapp");
    webAppContext.setContextPath("/");
    File[] mavenLibs = Maven.resolver().loadPomFromFile("pom.xml")
                .importCompileAndRuntimeDependencies()
                .resolve().withTransitivity().asFile();
    for (File file: mavenLibs) {
        webAppContext.getMetaData().addWebInfJar(new FileResource(file.toURI()));
    }
    webAppContext.getMetaData().addContainerResource(new FileResource(new File("./target/classes").toURI()));

    webAppContext.setConfigurations(new Configuration[] {
        new AnnotationConfiguration(),
        new WebXmlConfiguration(),
        new WebInfConfiguration()
    });
    server.setHandler(webAppContext);

    logger.info(">>> STARTING EMBEDDED JETTY SERVER");
    server.start();
    
}
 
开发者ID:pjagielski,项目名称:jersey2-starter,代码行数:26,代码来源:EmbeddedJetty.java

示例8: createConfigurations

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
private Configuration[] createConfigurations() {
    Configuration[] configurations = {
            new AnnotationConfiguration(),
            new WebInfConfiguration(),
            new WebXmlConfiguration(),
            new MetaInfConfiguration(),
            new FragmentConfiguration(),
            new EnvConfiguration(),
            new PlusConfiguration(),
            new JettyWebXmlConfiguration()
    };

    return configurations;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:15,代码来源:Application.java

示例9: beforeStart

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
@Override
public void beforeStart(WebAppContext context) {

    context.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, ".*/taglibs-standard-impl-[^/]*\\.jar$");
    Configuration[] current = context.getConfigurations();

    List<Configuration> cfn = new ArrayList<Configuration>(Arrays.asList(current));
    cfn.add(new EmbeddedJspConfiguration());
    context.setConfigurations(cfn.toArray(new Configuration[cfn.size()]));
}
 
开发者ID:eirbjo,项目名称:jetty-console,代码行数:11,代码来源:JspPlugin.java

示例10: configureWebAppContext

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
@Override
protected void configureWebAppContext(final WebContextWithExtraConfigurations context) throws Exception {
	super.configureWebAppContext(context);
	WebContextWithExtraConfigurations webAppContext = context;
	webAppContext.replaceConfiguration(MetaInfConfiguration.class, MetaInfFolderConfiguration.class);
	// webAppContext.replaceConfiguration(FragmentConfiguration.class,
	// FragmentFolderConfiguration.class);
	webAppContext.replaceConfiguration(WebInfConfiguration.class, WebInfFolderExtendedConfiguration.class);

	// TODO Review - 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, ".*\\.jar");
	webAppContext.setAttribute(WebInfConfiguration.WEBINF_JAR_PATTERN, ".*\\.jar");
}
 
开发者ID:logsniffer,项目名称:logsniffer,代码行数:16,代码来源:JettyIDELauncher.java

示例11: JettyLaucher

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
JettyLaucher(final Properties props) {
	String host = props.getProperty("host", "127.0.0.1");
	int port = Integer.parseInt(props.getProperty("port", "8080"));
	int timeout = Integer.parseInt(props.getProperty("timeoutSec", "900"));
	String baseDir  = props.getProperty("baseDir", "webapp");
	logger.info("Try to start server [{}:{}], baseDir={}, connection-timeout={}sec.", host, port, baseDir, timeout);
	System.setProperty(Constants.SYSPROP_DIR_WEBAPP, baseDir);

       // Handler for multiple web apps
       HandlerCollection handlers = new HandlerCollection();
       
       webAppContext = new WebAppContext();
       webAppContext.setContextPath("/");
       webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", 
               ".*/classes/*");
       webAppContext.setResourceBase(baseDir);
       webAppContext.setConfigurations(new Configuration[] {
       	    new AnnotationConfiguration(), new WebInfConfiguration(),
               new PlusConfiguration(), new MetaInfConfiguration(),
               new FragmentConfiguration(), new EnvConfiguration()
       	});
       handlers.addHandler(webAppContext);
       
	ServerConnector connector = new ServerConnector(server);
	connector.setHost(host);
	connector.setPort(port);
	connector.setIdleTimeout(timeout * 1000);
	server.addConnector(connector);
	 
	server.setHandler(handlers);
}
 
开发者ID:th-schwarz,项目名称:bacoma,代码行数:32,代码来源:JettyLaucher.java

示例12: start

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
private void start() {

        ProtectionDomain domain = WebAppRunner.class.getProtectionDomain();
        URL location = domain.getCodeSource().getLocation();

        WebAppContext context = new WebAppContext();
        context.setContextPath( "/" );
        context.setWar( location.toExternalForm() );
        context.setParentLoaderPriority( true );
        context.setConfigurations( new Configuration[] { 
                        new WebInfConfiguration(), 
                        new WebXmlConfiguration(),
                        new MetaInfConfiguration(),
                        new PlusConfiguration(), 
                        new JettyWebXmlConfiguration(),
                        new AnnotationConfiguration()
        } );

        Server server = new Server( 8080 );
        server.dumpStdErr();
        server.setHandler( context );
        try {
            server.start();
            server.join();
        }
        catch ( Exception e ) {
            LOG.warn( e );
        }
    }
 
开发者ID:ragnarruutel,项目名称:java8-jetty9-spring4-noxml,代码行数:30,代码来源:WebAppRunner.java

示例13: createWebAppContext

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
private WebAppContext createWebAppContext(String path, File war) throws MalformedURLException {
	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath(path);
	webAppContext.setParentLoaderPriority(false);
	if (war == null) {
		webAppContext.setWar(Main.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm());
	} else {
		webAppContext.setWar(war.toURI().toURL().toExternalForm());
	}
	webAppContext.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebInfConfiguration(),
			new WebXmlConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(),
			new EnvConfiguration(), new PlusConfiguration(), new JettyWebXmlConfiguration() });
	return webAppContext;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:15,代码来源:Main.java

示例14: loadWar

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
private void loadWar()
{
    File war = new File("./webapp/jqm-ws.war");
    if (!war.exists() || !war.isFile())
    {
        return;
    }
    jqmlogger.info("Jetty will now load the web service application war");

    // Load web application.
    webAppContext = new WebAppContext(war.getPath(), "/");
    webAppContext.setDisplayName("JqmWebServices");

    // Hide server classes from the web app
    final int nbEx = 5;
    String[] defExcl = webAppContext.getDefaultServerClasses();
    String[] exclusions = new String[defExcl.length + nbEx];
    for (int i = nbEx; i <= defExcl.length; i++)
    {
        exclusions[i] = defExcl[i - nbEx];
    }
    exclusions[0] = "com.enioka.jqm.tools.";
    exclusions[1] = "com.enioka.jqm.api.";
    // exclusions[2] = "org.slf4j.";
    // exclusions[3] = "org.apache.log4j.";
    exclusions[4] = "org.glassfish."; // Jersey
    webAppContext.setServerClasses(exclusions);

    // JQM configuration should be on the class path
    webAppContext.setExtraClasspath("conf/jqm.properties");
    webAppContext.setInitParameter("jqmnode", node.getName());
    webAppContext.setInitParameter("jqmnodeid", node.getId().toString());

    // Set configurations (order is important: need to unpack war before reading web.xml)
    webAppContext.setConfigurations(new Configuration[] { new WebInfConfiguration(), new WebXmlConfiguration(),
            new MetaInfConfiguration(), new FragmentConfiguration(), new AnnotationConfiguration() });

    h.addHandler(webAppContext);
}
 
开发者ID:enioka,项目名称:jqm,代码行数:40,代码来源:JettyServer.java

示例15: ExternalContext

import org.eclipse.jetty.webapp.WebInfConfiguration; //导入依赖的package包/类
public ExternalContext(String webAppRoot,
                         MetricRegistry metricsRegistry,
                         HealthCheckRegistry healthCheckRegistry,
                         String contextPath) throws IOException {
      super(webAppRoot, contextPath);

      setAttribute(METRICS_REGISTRY_SERVLET_ATTRIBUTE, metricsRegistry);
      setAttribute(HEALTH_CHECK_REGISTRY_SERVLET_ATTRIBUTE, healthCheckRegistry);

      setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricsRegistry);
      addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
      addFilter(RequestAndAccessCorrelationFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
      addFilter(InstrumentedFilter.class, "/*", EnumSet.allOf(DispatcherType.class));

      setConfigurations(new org.eclipse.jetty.webapp.Configuration[]{new WebInfConfiguration(),
                                                                     new WebXmlConfiguration(),
                                                                     new MetaInfConfiguration(),
                                                                     new JettyWebXmlConfiguration(),
                                                                     new TagLibConfiguration()});

      // Jetty requires a 'defaults descriptor' on the filesystem
setDefaultsDescriptor(extractWebdefaultXml().getPath());

      //ensure the logback settings we've already configured are re-used in the app.
      setParentLoaderPriority(true);

      //disable the default directory listing
      setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
  }
 
开发者ID:wotifgroup,项目名称:grails-lightweight-deploy,代码行数:30,代码来源:ExternalContext.java


注:本文中的org.eclipse.jetty.webapp.WebInfConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。