本文整理汇总了Java中org.eclipse.jetty.webapp.FragmentConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java FragmentConfiguration类的具体用法?Java FragmentConfiguration怎么用?Java FragmentConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FragmentConfiguration类属于org.eclipse.jetty.webapp包,在下文中一共展示了FragmentConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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: main
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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: createConfigurations
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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
示例4: JettyLaucher
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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
示例5: createWebAppContext
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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
示例6: loadWar
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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
示例7: build
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的package包/类
/**
* 创建用于正常运行调试的Jetty Server, 以src/main/webapp为Web应用目录.
*/
@Override
public Server build(int port, String webApp, String contextPath) throws BindException {
port = this.getAutoPort(port);
serverInitializer.run();
Server server = new Server(port);
WebAppContext webContext = new WebAppContext(webApp, contextPath);
if (false) {
ServletHolder holder = new ServletHolder(new ProxyServlet());
holder.setInitParameter("proxyTo", "http://localhost:3000/");
holder.setInitParameter("prefix", "/");
webContext.addServlet(holder, "/app/");
webContext.addServlet(new ServletHolder(new IndexServlet()), "/proxy/");
}
// webContext.setDefaultsDescriptor("leopard-jetty/webdefault.xml");
// 问题点:http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
webContext.setConfigurations(new Configuration[] { //
new EmbedWebInfConfiguration(), //
new MetaInfConfiguration(), //
new AnnotationConfiguration(), //
new WebXmlConfiguration(), //
new FragmentConfiguration() //
// new TagLibConfiguration() //
});
// webContext.setConfigurations(new Configuration[] { //
// new EmbedWebInfConfiguration()//
// , new EmbedWebXmlConfiguration()//
// , new EmbedMetaInfConfiguration()//
// , new EmbedFragmentConfiguration()//
// , new EmbedAnnotionConfiguration() //
// // , new PlusConfiguration(),//
// // new EnvConfiguration()//
// });
WebAppClassLoader classLoader = null;
try {
// addTldLib(webContext);
classLoader = new LeopardWebAppClassLoader(webContext);
}
catch (IOException e) {
e.printStackTrace();
}
// ClassLoader tldClassLoader = addTldLib(classLoader);
webContext.setClassLoader(classLoader);
webContext.setParentLoaderPriority(true);
// logger.debug(webContext.dump());
Handler rewriteHandler = ResourcesManager.getHandler();
if (rewriteHandler == null) {
server.setHandler(webContext);
}
else {
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(rewriteHandler);
handlers.addHandler(webContext);
server.setHandler(handlers);
}
server.setStopAtShutdown(true);
return server;
}
开发者ID:tanhaichao,项目名称:leopard,代码行数:73,代码来源:WebServerJettyImpl.java
示例8: createdWebAppContext
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的package包/类
/**
* Build web app context used to launch server.
* May be override by subclasses.
*
* @throws Exception May be thrown by web app context initialization (will be wrapped later).
*/
private WebAppContext createdWebAppContext() throws Exception {
final String path = configuration.getPath();
final String webapp = configuration.getWebapp();
final String classpath = configuration.getClasspath();
final Collection<URL> parentClasspath = configuration.getParentClasspath();
final String overrideDescriptor = configuration.getOverrideDescriptor ();
final Resource baseResource = configuration.getBaseResource();
final ClassLoader threadCl = Thread.currentThread().getContextClassLoader();
final ClassLoader classLoader;
if (!parentClasspath.isEmpty()) {
int nbUrls = parentClasspath.size();
URL[] urls = parentClasspath.toArray(new URL[nbUrls]);
classLoader = new URLClassLoader(urls, threadCl);
} else {
classLoader = threadCl;
}
WebAppContext ctx = new WebAppContext();
ctx.setClassLoader(classLoader);
ctx.setContextPath(path);
if (baseResource == null) {
// use default base resource
ctx.setBaseResource(newResource(webapp));
} else {
ctx.setBaseResource(baseResource);
}
if (overrideDescriptor != null) {
ctx.setOverrideDescriptor(overrideDescriptor);
}
ctx.setConfigurations(new Configuration[]{
new WebInfConfiguration(),
new WebXmlConfiguration(),
new AnnotationConfiguration(),
new JettyWebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration()
});
if (isNotBlank(classpath)) {
// Fix to scan Spring WebApplicationInitializer
// This will add compiled classes to jetty classpath
// See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
// And more precisely: http://stackoverflow.com/a/18449506/1215828
File classes = new File(classpath);
PathResource containerResources = new PathResource(classes.toURI());
ctx.getMetaData().addContainerResource(containerResources);
}
ctx.setParentLoaderPriority(true);
ctx.setWar(webapp);
ctx.setServer(server);
// Add server context
server.setHandler(ctx);
return ctx;
}
开发者ID:mjeanroy,项目名称:junit-servers,代码行数:68,代码来源:EmbeddedJetty.java
示例9: testCluster
import org.eclipse.jetty.webapp.FragmentConfiguration; //导入依赖的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");
}
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:75,代码来源:ClusterTest.java
注:本文中的org.eclipse.jetty.webapp.FragmentConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论