@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); } }
/** * @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); }
Thread.currentThread().setContextClassLoader(this.context.getClassLoader()); try { setExtendedListenerTypes(true);
/** * 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 ); } } }
if (context.getClassLoader() != null) loader = context.getClassLoader().getParent();
@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; } }
@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()) ); }
if (getClassLoader()==null) ClassLoader loader = getClassLoader(); LOG.debug("Thread Context classloader {}",loader); loader=loader.getParent();
if (web_inf != null && web_inf.isDirectory() && context.getClassLoader() instanceof WebAppClassLoader) ((WebAppClassLoader)context.getClassLoader()).addClassPath(classes); ((WebAppClassLoader)context.getClassLoader()).addJars(lib);
/** * 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(); }
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); } }
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); } }
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); } }
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); } }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }