本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.getClassLoader()
方法的一些代码示例,展示了WebAppContext.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.getClassLoader()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:getClassLoader
暂无
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public void configure(WebAppContext context) throws Exception {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(context.getClassLoader());
try {
callInitializers(context);
}
finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: org.springframework.boot/spring-boot
Thread.currentThread().setContextClassLoader(this.context.getClassLoader());
try {
setExtendedListenerTypes(true);
代码示例来源:origin: igniterealtime/Openfire
/**
* Removes a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind)
* functionality.
*
* Removing a handler, even when null, or non-existing, might have side-effects as introduced by the Jetty
* implementation. At the time of writing, Jetty will re
*
* @param handler The handler (should not be null).
*/
public void removeJettyHandler( Handler handler )
{
if (handler instanceof WebAppContext) {
// A work-around of the Jetty bug described at https://github.com/eclipse/jetty.project/issues/1425
// NOTE: According to some comments on WebAppLoaderFix, this may stop working on Java 9.
// Hopefully the Jetty team will have fixed the underlying bug by then
WebAppLoaderFix.checkAndClose(((WebAppContext) handler).getClassLoader());
}
extensionHandlers.removeHandler( handler );
if ( handler.isStarted() )
{
try
{
handler.stop();
}
catch ( Exception e )
{
Log.warn( "Unable to stop the handler that was removed: {}", handler, e );
}
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
if (context.getClassLoader() != null)
loader = context.getClassLoader().getParent();
代码示例来源: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: org.eclipse.jetty/jetty-webapp
@Override
public void dump(Appendable out, String indent) throws IOException
{
List<String> system_classes=null;
if (_systemClasses!=null)
{
system_classes=new ArrayList<>(_systemClasses);
Collections.sort(system_classes);
}
List<String> server_classes=null;
if (_serverClasses!=null)
{
server_classes=new ArrayList<>(_serverClasses);
Collections.sort(server_classes);
}
dumpObjects(out,indent,
new ClassLoaderDump(getClassLoader()),
new DumpableCollection("Systemclasses "+this,system_classes),
new DumpableCollection("Serverclasses "+this,server_classes),
new DumpableCollection("Configurations "+this,_configurations),
new DumpableCollection("Handler attributes "+this,((AttributesMap)getAttributes()).getAttributeEntrySet()),
new DumpableCollection("Context attributes "+this,((Context)getServletContext()).getAttributeEntrySet()),
new DumpableCollection("Initparams "+this,getInitParams().entrySet())
);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
if (getClassLoader()==null)
ClassLoader loader = getClassLoader();
LOG.debug("Thread Context classloader {}",loader);
loader=loader.getParent();
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
if (web_inf != null && web_inf.isDirectory() && context.getClassLoader() instanceof WebAppClassLoader)
((WebAppClassLoader)context.getClassLoader()).addClassPath(classes);
((WebAppClassLoader)context.getClassLoader()).addJars(lib);
代码示例来源:origin: org.eclipse.jetty/jetty-annotations
/**
* Test if the ServletContainerInitializer is from the container classpath
*
* @param context the context for the webapp classpath
* @param sci the ServletContainerIntializer
* @return true if ServletContainerIntializer is from container classpath
*/
public boolean isFromContainerClassPath (WebAppContext context, ServletContainerInitializer sci)
{
if (sci == null)
return false;
return sci.getClass().getClassLoader()==context.getClassLoader().getParent();
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
protected void createEnvContext (WebAppContext wac)
throws NamingException
{
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(wac.getClassLoader());
try
{
Context context = new InitialContext();
Context compCtx = (Context)context.lookup ("java:comp");
compCtx.createSubcontext("env");
}
finally
{
Thread.currentThread().setContextClassLoader(old_loader);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
protected void createEnvContext (WebAppContext wac)
throws NamingException
{
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(wac.getClassLoader());
try
{
Context context = new InitialContext();
Context compCtx = (Context)context.lookup ("java:comp");
compCtx.createSubcontext("env");
}
finally
{
Thread.currentThread().setContextClassLoader(old_loader);
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
protected void createEnvContext (WebAppContext wac)
throws NamingException
{
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(wac.getClassLoader());
try
{
Context context = new InitialContext();
Context compCtx = (Context)context.lookup ("java:comp");
compCtx.createSubcontext("env");
}
finally
{
Thread.currentThread().setContextClassLoader(old_loader);
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
protected void createEnvContext (WebAppContext wac)
throws NamingException
{
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(wac.getClassLoader());
try
{
Context context = new InitialContext();
Context compCtx = (Context)context.lookup ("java:comp");
compCtx.createSubcontext("env");
}
finally
{
Thread.currentThread().setContextClassLoader(old_loader);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
代码示例来源:origin: jenkinsci/winstone
/**
* @param servletContextName The servletContextName to set.
*/
@Override
public void setDisplayName(String servletContextName)
{
super.setDisplayName(servletContextName);
ClassLoader cl = getClassLoader();
if (cl!=null && cl instanceof WebAppClassLoader && servletContextName!=null)
((WebAppClassLoader)cl).setName(servletContextName);
}
内容来源于网络,如有侵权,请联系作者删除!