本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.setParentLoaderPriority()
方法的一些代码示例,展示了WebAppContext.setParentLoaderPriority()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setParentLoaderPriority()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setParentLoaderPriority
暂无
代码示例来源: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 = new WebAppContext();
webAppContext.setParentLoaderPriority(true);
webAppContext.setThrowUnavailableOnStartupException(true);
代码示例来源:origin: apache/geode
webapp.setContextPath(webAppContext);
webapp.setWar(warFilePath);
webapp.setParentLoaderPriority(false);
webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
webapp.addAliasCheck(new AllowSymLinkAliasChecker());
代码示例来源:origin: gocd/gocd
private WebAppContext createWebAppContext() {
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;
}
代码示例来源:origin: DeemOpen/zkui
clist.addBefore(JettyWebXmlConfiguration.class.getName(), AnnotationConfiguration.class.getName());
servletContextHandler.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*(/target/classes/|.*.jar)");
servletContextHandler.setParentLoaderPriority(true);
servletContextHandler.setInitParameter("useFileMappedBuffer", "false");
servletContextHandler.setAttribute("globalProps", globalProps);
代码示例来源:origin: apache/shiro
ctx.setParentLoaderPriority(true);
ctx.setWar(webapp);
ctx.setServer(server);
代码示例来源:origin: stackoverflow.com
WebAppContext webapp = new WebAppContext();
// ... various setup of the webapp ...
// Flip the classloader priority from servlet spec where webapp is first to
// Standard java behavior of parent (aka Server classloader) is first.
webapp.setParentLoaderPriority(true);
代码示例来源: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: jamesagnew/hapi-fhir
root.setAllowDuplicateFragmentNames(true);
root.setWar(tempWarFile.getAbsolutePath());
root.setParentLoaderPriority(true);
root.setContextPath("/");
root.addEventListener(new ServletContextListener() {
代码示例来源:origin: io.provis/provisio-webserver-jetty8
private WebAppContext warWebApp(String context, File war) throws IOException {
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
webAppContext.setWar(war.getAbsolutePath());
webAppContext.setParentLoaderPriority(true);
return webAppContext;
}
代码示例来源: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: io.provis/provisio-webserver-jetty8
private WebAppContext inSituWebApp(String context, File currentWorkingDirectory) throws IOException {
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
File webAppDirectory = new File(currentWorkingDirectory, "src/main/webapp");
if (!webAppDirectory.exists()) {
throw new RuntimeException("Expecting to find a standard webapp project but there is no src/main/webapp directory.");
}
webAppContext.setBaseResource(Resource.newResource(webAppDirectory));
webAppContext.setParentLoaderPriority(true);
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: com.thoughtworks.inproctester/inproctester-jetty
private WebAppContext createWebAppContext(String webApp, String contextPath) {
WebAppContext context = new WebAppContext();
context.setWar(webApp);
context.setContextPath(contextPath);
context.setParentLoaderPriority(true);
context.setThrowUnavailableOnStartupException(true);
return context;
}
代码示例来源:origin: aharin/inproctester
private static ServletContextHandler createWebAppContext(String webApp, String contextPath) {
WebAppContext context = new WebAppContext();
context.setWar(webApp);
context.setContextPath(contextPath);
context.setParentLoaderPriority(true);
context.setThrowUnavailableOnStartupException(true);
return context;
}
代码示例来源:origin: io.snappydata/gemfire-core
public static Server addWebApplication(final Server jetty,
final String webAppContext, final String warFilePath) throws IOException {
WebAppContext webapp = new WebAppContext();
webapp.setContextPath(webAppContext);
webapp.setWar(warFilePath);
webapp.setParentLoaderPriority(false);
File tmpPath = new File(getWebAppBaseDirectory(webAppContext));
Files.createDirectories(tmpPath.toPath());
webapp.setTempDirectory(tmpPath);
((HandlerCollection) jetty.getHandler()).addHandler(webapp);
return jetty;
}
内容来源于网络,如有侵权,请联系作者删除!