本文整理汇总了Java中org.eclipse.jetty.plus.webapp.EnvConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java EnvConfiguration类的具体用法?Java EnvConfiguration怎么用?Java EnvConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnvConfiguration类属于org.eclipse.jetty.plus.webapp包,在下文中一共展示了EnvConfiguration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的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();
}
示例2: createConfigurations
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的package包/类
private Configuration[] createConfigurations() {
Configuration[] configurations = {
new AnnotationConfiguration(),
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new PlusConfiguration(),
new JettyWebXmlConfiguration()
};
return configurations;
}
示例3: createEnvConfiguration
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的package包/类
protected EnvConfiguration createEnvConfiguration() {
EnvConfiguration envConfiguration = new EnvConfiguration();
if (jettyEnvPathUrl != null) {
envConfiguration.setJettyEnvXml(jettyEnvPathUrl);
}
return envConfiguration;
}
示例4: JettyConsoleWebappContext
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的package包/类
public JettyConsoleWebappContext(HandlerContainer parent, String webApp, String contextPath) {
super(parent, webApp, contextPath);
setConfigurations(new Configuration[]{
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new org.eclipse.jetty.plus.webapp.PlusConfiguration(),
new AnnotationConfiguration(),
new JettyWebXmlConfiguration()
});
}
示例5: createClassList
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的package包/类
private Configuration.ClassList createClassList() {
Configuration.ClassList classList = new Configuration.ClassList(new String[0]);
classList.add(AnnotationConfiguration.class.getName());
classList.add(WebInfConfiguration.class.getName());
classList.add(WebXmlConfiguration.class.getName());
classList.add(MetaInfConfiguration.class.getName());
classList.add(FragmentConfiguration.class.getName());
classList.add(JettyWebXmlConfiguration.class.getName());
classList.add(EnvConfiguration.class.getName());
classList.add(PlusConfiguration.class.getName());
return classList;
}
示例6: JettyLaucher
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的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);
}
示例7: createWebAppContext
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的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;
}
示例8: testCluster
import org.eclipse.jetty.plus.webapp.EnvConfiguration; //导入依赖的package包/类
@Test
public void testCluster() throws Exception {
String projectBaseDirectory = System.getProperty("user.dir");
//
// Create master node
//
Server masterServer = new Server(8080);
WebAppContext masterContext = new WebAppContext();
masterContext.setDescriptor(projectBaseDirectory + "/target/vaporware/WEB-INF/web.xml");
masterContext.setResourceBase(projectBaseDirectory + "/target/vaporware");
masterContext.setContextPath("/");
masterContext.setConfigurations(
new Configuration[] {
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new PlusConfiguration(),
new AnnotationConfiguration(),
new JettyWebXmlConfiguration(),
new TagLibConfiguration()
}
);
masterContext.setParentLoaderPriority(true);
masterServer.setHandler(masterContext);
masterServer.start();
//masterServer.join();
//
// Create slave node
//
Server slaveServer = new Server(8181);
WebAppContext slaveContext = new WebAppContext();
slaveContext.setDescriptor(projectBaseDirectory + "/target/vaporware/WEB-INF/web-slave.xml");
slaveContext.setResourceBase(projectBaseDirectory + "/target/vaporware");
slaveContext.setContextPath("/");
slaveContext.setConfigurations(
new Configuration[] {
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new PlusConfiguration(),
new AnnotationConfiguration(),
new JettyWebXmlConfiguration(),
new TagLibConfiguration()
}
);
slaveContext.setParentLoaderPriority(true);
slaveServer.setHandler(slaveContext);
slaveServer.start();
//slaveServer.join();
// Try to let the user terminate the Jetty server instances gracefully. This won't work in an environment like Eclipse, if
// console input can't be received. However, even in that that case you will be able to kill the Maven process without
// a Java process lingering around (as would be the case if you used "Sever.join()" to pause execution of this thread).
System.out.println("PRESS <ENTER> TO HALT SERVERS (or kill the Maven process)...");
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
System.out.println(line);
scanner.close();
masterServer.stop();
slaveServer.stop();
System.out.println("Servers halted");
}