本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.setClassLoader()
方法的一些代码示例,展示了WebAppContext.setClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setClassLoader()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setClassLoader
暂无
代码示例来源:origin: apache/nifi
webappContext.setClassLoader(new WebAppClassLoader(parentClassLoader, webappContext));
} catch (final IOException ioe) {
startUpFailure(ioe);
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
@Override
protected void stopContext() throws Exception
{
stopWebapp();
try
{
for (int i=_configurations.size();i-->0;)
_configurations.get(i).deconfigure(this);
if (_metadata != null)
_metadata.clear();
_metadata=new MetaData();
}
finally
{
if (_ownClassLoader)
{
ClassLoader loader = getClassLoader();
if (loader != null && loader instanceof URLClassLoader)
((URLClassLoader)loader).close();
setClassLoader(null);
}
setAvailable(true);
_unavailableException=null;
}
}
代码示例来源:origin: apache/shiro
ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
ctx.setContextPath(path);
代码示例来源:origin: line/armeria
static WebAppContext newWebAppContext() throws MalformedURLException {
final WebAppContext handler = new WebAppContext();
handler.setContextPath("/");
handler.setBaseResource(Resource.newResource(webAppRoot()));
handler.setClassLoader(new URLClassLoader(
new URL[] {
Resource.newResource(new File(webAppRoot(),
"WEB-INF" + File.separatorChar +
"lib" + File.separatorChar +
"hello.jar")).getURI().toURL()
},
JettyService.class.getClassLoader()));
handler.addBean(new ServletContainerInitializersStarter(handler), true);
handler.setAttribute(
"org.eclipse.jetty.containerInitializers",
Collections.singletonList(new ContainerInitializer(new JettyJasperInitializer(), null)));
return handler;
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
setClassLoader(classLoader);
_ownClassLoader=true;
代码示例来源:origin: org.springframework.boot/spring-boot
context.setTempDirectory(getTempDirectory());
if (this.resourceLoader != null) {
context.setClassLoader(this.resourceLoader.getClassLoader());
代码示例来源:origin: org.joinfaces/jsf-jetty-spring-boot-autoconfigure
@Override
public Void run() {
webAppContext.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader()));
return null;
}
});
代码示例来源:origin: org.joinfaces/jsf-spring-boot-autoconfigure
@Override
public Void run() {
webAppContext.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader()));
return null;
}
});
代码示例来源:origin: com.github.persapiens/jsf-jetty-spring-boot-autoconfigure
@Override
public Void run() {
webAppContext.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader()));
return null;
}
});
代码示例来源:origin: apache/atlas
protected WebAppContext getWebAppContext(String path) {
WebAppContext application = new WebAppContext(path, "/");
application.setClassLoader(Thread.currentThread().getContextClassLoader());
// Disable directory listing
application.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
return application;
}
代码示例来源:origin: stackoverflow.com
WebAppContext webapp = new WebAppContext();
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
URLClassLoader subClassLoader = new URLClassLoader(new URL[]{}, currentClassLoader);//this is the point.
webapp.setClassLoader(subClassLoader); //this is the point.
webapp.setContextPath("/");
webapp.setResourceBase("src/main/webapp");
server.setHandler(webapp);
server.start();
server.join();
代码示例来源:origin: stackoverflow.com
...
WebAppContext webapp = new WebAppContext();
// classURLs may contains URL to WEB-INF/classes or WEB-INF/lib/additional_jar of you web app
URLClassLoader classLoader = new URLClassLoader(classURLs.toArray(new URL[classURLs.size()]),
Thread.currentThread().getContextClassLoader());
webapp.setClassLoader(classLoader);
...
ContextHandlerCollection contextCollection = new ContextHandlerCollection();
contextCollection.addHandler(webapp);
...
Server server = new Server(threadPool);
server.setHandler(contextCollection);
server.start();
...
代码示例来源:origin: stackoverflow.com
public class Jetty {
public static Server createServer(int port) {
Server server = new Server(port);
WebAppContext context = new WebAppContext();
context.setResourceBase("src/main/webapp");
context.setClassLoader(Thread.currentThread().getContextClassLoader());
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{context});
server.setHandler(handlers);
return server;
}
}
代码示例来源:origin: jetty-project/i-jetty
public void preConfigure(WebAppContext context)
throws Exception
{
context.setClassLoader(new AndroidClassLoader(this.getClass().getClassLoader(), context));
super.preConfigure(context);
Log.debug("Setting classloader parent="+this.getClass().getClassLoader()+" for context: "+context);
}
代码示例来源:origin: com.github.dapeng-soa/dapeng-api-doc
public static Server createServer(int port) throws MalformedURLException, URISyntaxException {
Server server = new Server();
server.setStopAtShutdown(true);
ServerConnector connector = new ServerConnector(server);
connector.setPort(port);
connector.setReuseAddress(true);
server.setConnectors(new Connector[]{connector});
WebAppContext webContext = new WebAppContext("webapp", CONTEXT);
webContext.setBaseResource(Resource.newResource(new URL(ApiWebSite.class.getResource("/webapp/WEB-INF"), ".")));
webContext.setClassLoader(ApiWebSite.class.getClassLoader());
server.setHandler(webContext);
return server;
}
代码示例来源:origin: com.cybermkd/ICEREST
public void onChange() {
try {
System.err.println("\nLoading changes ......");
webApp.stop();
IceRestClassLoader loader = new IceRestClassLoader(webApp, getClassPath());
webApp.setClassLoader(loader);
webApp.start();
System.err.println("Loading complete.");
} catch (Exception e) {
System.err.println("Error reconfiguring/restarting webapp after change in watched files");
logger.error(e.getMessage(), e);
}
}
};
代码示例来源:origin: dhanji/sitebricks
public Jetty(String path, int port, ClassLoader classLoader, Injector injector) {
WebAppContext webAppContext = new WebAppContext(path, APP_NAME);
webAppContext.setClassLoader(classLoader);
webAppContext.getServletContext().setAttribute(INJECTOR_KEY, injector);
setUp(webAppContext, port);
}
代码示例来源:origin: com.jfinal/jetty-server
private void changeClassLoader(WebAppContext webApp) {
try {
String classPath = getClassPath();
JFinalClassLoader jfcl = new JFinalClassLoader(webApp, classPath);
// jfcl.addClassPath(classPath);
webApp.setClassLoader(jfcl);
} catch (IOException e) {
LogKit.error(e.getMessage(), e);
}
}
代码示例来源:origin: com.cybermkd/ICEREST
private void changeClassLoader(WebAppContext webApp) {
try {
String classPath = getClassPath();
IceRestClassLoader jfcl = new IceRestClassLoader(webApp, classPath);
jfcl.addClassPath(classPath);
webApp.setClassLoader(jfcl);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
代码示例来源:origin: T-baby/ICERest
private void changeClassLoader(WebAppContext webApp) {
try {
String classPath = getClassPath();
IceRestClassLoader jfcl = new IceRestClassLoader(webApp, classPath);
jfcl.addClassPath(classPath);
webApp.setClassLoader(jfcl);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!