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


Java WebXmlConfiguration类代码示例

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


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

示例1: init

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的package包/类
private void init() {
	System.out.println("host:" + hostList + " war:" + war);
	this.setContextPath("/");
	this.setWar(war);
	if (hostList != null && !hostList.isEmpty()) {
		if (!"localhost".equals(hostList.get(0))) {
			String[] hosts = new String[hostList.size()];
			hostList.toArray(hosts);
			super.setVirtualHosts(hosts);
		}
	}

	this.setConfigurations(new Configuration[] { //
			new io.leopard.myjetty.webapp.EmbedWebInfConfiguration(hostList, war), //
			new MetaInfConfiguration(), //
			new AnnotationConfiguration(), //
			new WebXmlConfiguration(), //
			new FragmentConfiguration() //
			// new TagLibConfiguration() //
	});
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:22,代码来源:MyJettyWebAppContext.java

示例2: createFrontAppContext

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的package包/类
protected WebAppContext createFrontAppContext(ClassLoader serverClassLoader, ClassLoader sharedClassLoader) throws URISyntaxException {
    ClassLoader frontClassLoader = new URLClassLoader(pathsToURLs(serverClassLoader, getAppClassesPath(FRONT_PATH_IN_JAR)), sharedClassLoader);

    WebAppContext frontContext = new WebAppContext();
    frontContext.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
    frontContext.setContextPath(frontContextPath);
    frontContext.setClassLoader(frontClassLoader);

    setResourceBase(serverClassLoader, frontContext, FRONT_PATH_IN_JAR);

    System.setProperty("cuba.front.baseUrl", PATH_DELIMITER.equals(frontContextPath) ? frontContextPath :
            frontContextPath + PATH_DELIMITER);
    System.setProperty("cuba.front.apiUrl", PATH_DELIMITER.equals(contextPath) ? "/rest/" :
            contextPath + PATH_DELIMITER + "rest" + PATH_DELIMITER);

    return frontContext;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:CubaJettyServer.java

示例3: main

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例4: createWebAppContext

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例5: shouldAddWebAppContextHandler

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例6: createControlledBounceproxyWebApp

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例7: createBounceproxyControllerWebApp

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例8: start

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例9: createConfigurations

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的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

示例10: createAppContext

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的package包/类
protected WebAppContext createAppContext(ClassLoader serverClassLoader, ClassLoader sharedClassLoader,
                                         String appPathInJar, String contextPath) throws URISyntaxException {
    ClassLoader appClassLoader = new URLClassLoader(pathsToURLs(serverClassLoader, getAppClassesPath(appPathInJar)), sharedClassLoader);

    WebAppContext appContext = new WebAppContext();
    appContext.setConfigurations(new Configuration[]{new WebXmlConfiguration(), createEnvConfiguration()});
    appContext.setContextPath(contextPath);
    appContext.setClassLoader(appClassLoader);

    setResourceBase(serverClassLoader, appContext, appPathInJar);

    return appContext;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:CubaJettyServer.java

示例11: createWebServer

import org.eclipse.jetty.webapp.WebXmlConfiguration; //导入依赖的package包/类
@Override
protected ServletContext createWebServer() throws Exception {
    server = new Server(new ThreadPoolImpl(new ThreadPoolExecutor(10, 10, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), r -> {
        Thread t = new Thread(r);
        t.setName("Jetty Thread Pool");
        return t;
    })));

    WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
    context.setClassLoader(getClass().getClassLoader());
    context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
    context.addBean(new NoListenerConfiguration(context));
    server.setHandler(context);
    context.setMimeTypes(MIME_TYPES);
    context.getSecurityHandler().setLoginService(configureUserRealm());
    context.setResourceBase(WarExploder.getExplodedDir().getPath());

    ServerConnector connector = new ServerConnector(server);
    HttpConfiguration config = connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
    // use a bigger buffer as Stapler traces can get pretty large on deeply nested URL
    config.setRequestHeaderSize(12 * 1024);
    connector.setHost(ADDRESS);
    if (System.getProperty("port") != null)
        connector.setPort(Integer.parseInt(System.getProperty("port")));

    server.addConnector(connector);
    server.start();

    localPort = connector.getLocalPort();
    LOG.info("Running on {}", getURL());

    return context.getServletContext();
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:34,代码来源:DockerSimpleBuildWrapperTest.java

示例12: start

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