本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.setDescriptor()
方法的一些代码示例,展示了WebAppContext.setDescriptor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setDescriptor()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setDescriptor
暂无
代码示例来源:origin: stackoverflow.com
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class JettyServer {
public static void main(String[] args) {
Server server = new Server(8080);
WebAppContext context = new WebAppContext();
context.setResourceBase("../webapp-project/WebContent");
context.setDescriptor("../webapp-project/WebContent/WEB-INF/web.xml");
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: ocpsoft/prettytime
public static void main(String[] args) throws Exception {
String weppAppHome = args[0];
Integer port = 8080;
Server server = new Server(port);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setCompactPath(true);
webapp.setDescriptor(weppAppHome + "/WEB-INF/web.xml");
webapp.setResourceBase(weppAppHome);
webapp.setParentLoaderPriority(true);
server.setHandler(webapp);
server.start();
server.join();
}
代码示例来源:origin: kaaproject/kaa
@Override
public void start() {
LOG.info("Starting Kaa Admin Web Server...");
server = new Server(adminPort);
webAppContext = new WebAppContext();
webAppContext.setEventListeners(new EventListener[]{adminContextLoaderListener});
webAppContext.setContextPath("/");
String webXmlLocation = AdminInitializationService.class.getResource("/admin-web/WEB-INF/"
+ webXmlFile).toString();
webAppContext.setDescriptor(webXmlLocation);
String resLocation = AdminInitializationService.class.getResource("/admin-web").toString();
webAppContext.setResourceBase(resLocation);
webAppContext.setParentLoaderPriority(true);
server.setHandler(webAppContext);
try {
server.start();
LOG.info("Kaa Admin Web Server started.");
} catch (Exception ex) {
LOG.error("Error starting Kaa Admin Web Server!", ex);
}
}
代码示例来源:origin: Dreampie/Resty
webAppContext.setDescriptor(webXmlPath);
webAppContext.setContextPath(contextPath);
webAppContext.setResourceBase(webappUrl);
代码示例来源:origin: jamesagnew/hapi-fhir
public static void main(String[] theArgs) {
Server server = new Server(22);
String path = "../hapi-fhir-cli-jpaserver";
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-example");
webAppContext.setParentLoaderPriority(true);
server.setHandler(webAppContext);
try {
server.start();
} catch (Exception e) {
e.printStackTrace();
}
ourLog.info("Started");
}
代码示例来源:origin: apache/phoenix
@Override
public int run(String[] arg0) throws Exception {
// logProcessInfo(getConf());
final int port = getConf().getInt(TRACE_SERVER_HTTP_PORT_KEY,
DEFAULT_HTTP_PORT);
BasicConfigurator.configure();
final String home = getConf().get(TRACE_SERVER_HTTP_JETTY_HOME_KEY,
DEFAULT_HTTP_HOME);
//setting up the embedded server
Server server = new Server(port);
WebAppContext root = new WebAppContext();
URL webAppDir = Thread.currentThread().getContextClassLoader().getResource(DEFAULT_WEBAPP_DIR_LOCATION);
if (webAppDir == null) {
throw new RuntimeException(String.format("No %s directory was found into the JAR file", DEFAULT_WEBAPP_DIR_LOCATION));
}
root.setContextPath(home);
root.setDescriptor(DEFAULT_WEBAPP_DIR_LOCATION + "/WEB-INF/web.xml");
root.setResourceBase(webAppDir.toURI().toString());
root.setParentLoaderPriority(true);
server.setHandler(root);
server.start();
server.join();
return 0;
}
}
代码示例来源:origin: pulsarIO/realtime-analytics
public void startStandAlone() {
try {
WebAppContext context = new WebAppContext();
String baseUrl = getBaseUrl();
LOGGER.info("Metric server baseUrl: " + baseUrl);
context.setDescriptor(baseUrl + "/WEB-INF/web.xml");
context.setResourceBase(baseUrl);
context.setContextPath("/");
context.setParentLoaderPriority(true);
context.setAttribute("JetStreamRoot", applicationContext);
Server s_server = new Server(s_port);
s_server.setHandler(context);
LOGGER.info( "Metric server started, listening on port " + s_port);
s_server.start();
running.set(true);
} catch (Throwable t) {
throw CommonUtils.runtimeException(t);
}
}
代码示例来源:origin: stackoverflow.com
private static void run(int port, String resourceBase, String descriptor) {
Server server = new Server(port);
WebAppContext context = new WebAppContext();
context.setResourceBase(resourceBase);
context.setDescriptor(descriptor);
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}
代码示例来源:origin: stackoverflow.com
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setResourceBase(webroot);
webapp.setDescriptor(webroot + "/WEB-INF/web.xml");
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setPort(8080);
server.setConnectors(new ServerConnector[] { connector });
server.setHandler(webapp);
// Add this line
WebSocketServerContainerInitializer.configureContext(webapp);
server.start();
server.join();
代码示例来源:origin: stackoverflow.com
private WebAppContext webAppContext;
public WebAppContext buildWebAppContext() {
webAppContext = new WebAppContext();
webAppContext.setDescriptor(webAppContext + "/WEB-INF/web.xml");
webAppContext.setResourceBase("src/main/webapp");
webAppContext.setContextPath("/Holmes");
return webAppContext;
}
}
代码示例来源:origin: stackoverflow.com
public class AppContextBuilder {
private WebAppContext webAppContext;
public WebAppContext buildWebAppContext() {
webAppContext = new WebAppContext();
webAppContext.setDescriptor(webAppContext + "/WEB-INF/web.xml");
webAppContext.setResourceBase(webAppContext);
webAppContext.setContextPath("/Holmes");
return webAppContext;
}
}
代码示例来源:origin: stackoverflow.com
Resource jettyConfig = Resource.newSystemResource("jetty.xml");
XmlConfiguration configuration = new XmlConfiguration(jettyConfig.getInputStream());
Server server = (Server)configuration.configure();
WebAppContext wac = new WebAppContext();
wac.setResourceBase(".");
wac.setDescriptor("WEB-INF/web.xml");
wac.setContextPath("/");
wac.setParentLoaderPriority(true);
server.setHandler(wac);
server.start();
代码示例来源:origin: stackoverflow.com
@Override
public void start() throws Exception {
// Set up the handler for the web application context.
WebAppContext root = new WebAppContext();
root.setExtraClasspath(extraClassPath);
root.setDescriptor(new File(appDir, "WEB-INF/web.xml").getAbsolutePath());
root.setWar(new File(appDir).getAbsolutePath());
root.setContextPath(contextPath);
root.setParentLoaderPriority(true);
server.setHandler(root);
server.start();
System.out.println("Jetty server is started!");
}
代码示例来源:origin: stackoverflow.com
WebAppContext webAppContext = new WebAppContext();
webAppContext.setResourceBase(webApp.appDir);
webAppContext.setDescriptor(webApp.appDir
+ "/WEB-INF/web.xml");
webAppContext.setContextPath(webApp.contextPath);
webAppContext.setParentLoaderPriority(true);
// webAppContext.setWar(webApp.appDir);
//webAppContext.setVirtualHosts(webApp.hostName);
代码示例来源:origin: xsank/Shour
private WebAppContext buildContext() {
WebAppContext context = new WebAppContext();
context.setDefaultsDescriptor("webapp/WEB-INF/webdefault.xml");
context.setDescriptor("webapp/WEB-INF/web.xml");
context.setResourceBase("webapp/");
context.setContextPath("/");
return context;
}
代码示例来源:origin: stackoverflow.com
WebAppContext context = new WebAppContext();
context.setContextPath("/myWebApp");
context.setExtractWAR(false);
context.setDescriptor("/file/system/path/to/your/wab/app/WEB-INF/web.xml");
context.setResourceBase("/file/system/path/to/your/wab/app");
context.setConfigurationDiscovered(false);
HandlerList handlerList=new HandlerList();
handlerList.addHandler(webAppContext);
Server server = new Server(threadPool);
server.setHandler(handlerList);
server.start();
代码示例来源:origin: epam/Wilma
private WebAppContext configureWebAppContext() {
final WebAppContext context = new WebAppContext();
String baseUrl = getBaseUrl();
context.setDescriptor(baseUrl + WEB_XML_LOCATION);
context.setResourceBase(baseUrl + "");
context.setContextPath("/");
context.setParentLoaderPriority(true);
WebAppStopper webAppStopper = new WebAppStopper(this, Executors.newSingleThreadExecutor());
Servlet shutdownServlet = new ShutdownServlet(webAppStopper);
context.addServlet(new ServletHolder(shutdownServlet), SHUTDOWN_URL);
return context;
}
代码示例来源:origin: org.unidal.framework/test-framework
protected void configure(WebAppContext context) throws Exception {
File warRoot = getWarRoot();
m_resource = new WebModuleResource(warRoot);
context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
context.setContextPath(getContextPath());
context.setDescriptor(new File(warRoot, "WEB-INF/web.xml").getPath());
context.setBaseResource(m_resource);
}
代码示例来源:origin: apache/cxf
@Override
protected void configureContext(final WebAppContext context) throws Exception {
context.setDescriptor(Resource
.newClassPathResource("/WEB-INF/web-subclass.xml").getFile().toURI().getPath());
}
}
代码示例来源:origin: apache/cxf
@Override
protected void configureContext(final WebAppContext context) throws Exception {
context.setDescriptor(Resource.newClassPathResource("/WEB-INF/web.xml").getFile().toURI().getPath());
}
}
内容来源于网络,如有侵权,请联系作者删除!