本文整理了Java中org.apache.catalina.Context.setParentClassLoader()
方法的一些代码示例,展示了Context.setParentClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.setParentClassLoader()
方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:setParentClassLoader
暂无
代码示例来源:origin: stackoverflow.com
ctx.setParentClassLoader(EmbeddedTomcatTestBase.class.getClassLoader());
代码示例来源:origin: Red5/red5-plugins
ctx.setParentClassLoader(classLoader);
代码示例来源:origin: com.github.mjeanroy/junit-servers-tomcat
context.setParentClassLoader(tomcatParentClassLoader);
代码示例来源:origin: justlive1/oxygen
private void initServer() {
if (tomcat == null) {
tomcat = new Tomcat();
}
WebConf webConf = ConfigFactory.load(WebConf.class);
File baseDir = new File(ConfigFactory.load(CoreConf.class).getBaseTempDir(),
Tomcat.class.getSimpleName());
File docBase = new File(baseDir, Context.class.getSimpleName());
checkDir(baseDir, docBase);
tomcat.setBaseDir(baseDir.getAbsolutePath());
Host host = tomcat.getHost();
host.setAutoDeploy(false);
Context ctx = tomcat.addWebapp(host, webConf.getContextPath(), docBase.getAbsolutePath(),
new FatJarContextConfig());
ctx.setJarScanner(new FatJarScanner());
ctx.setParentClassLoader(getClass().getClassLoader());
ctx.addLifecycleListener(new FatJarWebXmlListener());
tomcat.setPort(webConf.getPort());
TomcatConf tomcatConf = ConfigFactory.load(TomcatConf.class);
configConnector(tomcat.getConnector(), tomcatConf);
configEngine(tomcat.getEngine(), tomcatConf);
}
代码示例来源:origin: apache/tomcat-maven-plugin
context.setParentClassLoader( getTomcatClassLoader() );
代码示例来源:origin: apache/tomcat-maven-plugin
context.setParentClassLoader( getTomcatClassLoader() );
代码示例来源:origin: apache/tomcat-maven-plugin
context.setParentClassLoader( getTomcatClassLoader() );
代码示例来源:origin: hengyunabc/executable-embeded-tomcat-sample
public static void main(String[] args) throws ServletException, LifecycleException, IOException {
String hostName = "localhost";
int port = 8080;
String contextPath = "";
String tomcatBaseDir = TomcatUtil.createTempDir("tomcat", port).getAbsolutePath();
String contextDocBase = TomcatUtil.createTempDir("tomcat-docBase", port).getAbsolutePath();
Tomcat tomcat = new Tomcat();
tomcat.setBaseDir(tomcatBaseDir);
tomcat.setPort(port);
tomcat.setHostname(hostName);
Host host = tomcat.getHost();
Context context = tomcat.addWebapp(host, contextPath, contextDocBase, new EmbededContextConfig());
context.setJarScanner(new EmbededStandardJarScanner());
ClassLoader classLoader = Main.class.getClassLoader();
context.setParentClassLoader(classLoader);
// context load WEB-INF/web.xml from classpath
context.addLifecycleListener(new WebXmlMountListener());
tomcat.start();
tomcat.getServer().await();
}
}
代码示例来源:origin: Red5/red5-plugins
if (ldr == null) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ctx.setParentClassLoader(classLoader);
WebappLoader wldr = new WebappLoader(classLoader);
代码示例来源:origin: Red5/red5-plugins
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ctx.setParentClassLoader(classLoader);
内容来源于网络,如有侵权,请联系作者删除!