super.setLoader(loader);
public static StandardContext createContext() { final StandardEngine engine = new StandardEngine(); engine.setService( new StandardService() ); final StandardContext context = new StandardContext(); context.setPath( "/" ); context.setSessionCookiePath( "/" ); final WebappLoader webappLoader = new WebappLoader() { @Override public ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); } }; context.setLoader( webappLoader ); final StandardHost host = new StandardHost(); engine.addChild( host ); host.addChild( context ); return context; }
/** * Creates a classloader for this context. */ public void createLoader() { ClassLoader parent = null; if (getPrivileged()) { if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Configuring privileged default Loader"); } parent = this.getClass().getClassLoader(); } else { if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Configuring non-privileged default Loader"); } parent = getParentClassLoader(); } WebappLoader webappLoader = new WebappLoader(parent); webappLoader.setDelegate(getDelegate()); webappLoader.setUseMyFaces(useMyFaces); setLoader(webappLoader); }
private void initContextLoader(final StandardContext standardContext) { final Loader standardContextLoader = standardContext.getLoader(); if (standardContextLoader != null && ( (!TomEEWebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.equals(standardContextLoader.getClass())) || (WebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.cast(standardContextLoader).getLoaderClass().startsWith("org.apache.tom"))) ) { // custom loader, we don't know it // and since we don't have a full delegate pattern for our lazy stop loader // simply skip lazy stop loader - normally sides effect will be an early shutdown for ears and some particular features // only affecting the app if the classes were not laoded at all return; } if (standardContextLoader != null && TomEEWebappLoader.class.isInstance(standardContextLoader)) { standardContextLoader.setContext(standardContext); return; // no need to replace the loader } // we just want to wrap it to lazy stop it (afterstop) // to avoid classnotfound in @PreDestoy or destroyApplication() final TomEEWebappLoader loader = new TomEEWebappLoader(); loader.setDelegate(standardContext.getDelegate()); loader.setLoaderClass(TomEEWebappClassLoader.class.getName()); final Loader lazyStopLoader = new LazyStopLoader(loader); standardContext.setLoader(lazyStopLoader); }
private StandardContext createContext(String path, String docBase, ClassLoader classLoader, Map<String, List<Injector<?>>> injectors) { StandardContext context = new StandardContext(); context.setDocBase(docBase); context.setPath(path); ContextConfig config = new ContextConfig(); context.addLifecycleListener(config); context.setParentClassLoader(classLoader); Fabric3Loader loader = new Fabric3Loader(classLoader); context.setLoader(loader); // turn off unpacking so Tomcat does not copy the extracted WAR to the /webapps directory and autodeploy it on a subsequent boot context.setUnpackWAR(false); Fabric3AnnotationProcessor annotationProcessor = new Fabric3AnnotationProcessor(injectors); context.setAnnotationProcessor(annotationProcessor); context.getServletContext().setAttribute(AnnotationProcessor.class.getName(), annotationProcessor); return (context); }
context.setLoader(loader); context.setInstanceManager(new LocalInstanceManager());
serverContext.setLoader(loader); serverContext.setInstanceManager(new LocalInstanceManager());
serverContext.setLoader(loader); serverContext.setInstanceManager(new LocalInstanceManager());
standardContext.setLoader(new TomEEWebappLoader(appInfo.path, classLoader)); standardContext.getLoader().setDelegate(true);
_serverContext.setLoader(loader); _serverContext.setInstanceManager(new LocalInstanceManager());
_serverContext.setLoader(loader); _serverContext.setInstanceManager(new LocalInstanceManager());
context.setLoader(webLoader);
appContext.setLoader(loader); setContextXml(appContext); appContext.addLifecycleListener(this);
serverContext.setLoader(loader); serverContext.setInstanceManager(new LocalInstanceManager());
serverContext.setLoader(loader); serverContext.setInstanceManager(new LocalInstanceManager());
private static StandardContext startWebApp(Host host, WSEndpointDeploymentUnit unit) throws Exception { StandardContext context = new StandardContext(); try { JBossWebMetaData jbwebMD = unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY); context.setPath(jbwebMD.getContextRoot()); context.addLifecycleListener(new ContextConfig()); ServerConfigService config = (ServerConfigService)unit.getServiceRegistry().getService(WSServices.CONFIG_SERVICE).getService(); File docBase = new File(config.getValue().getServerTempDir(), jbwebMD.getContextRoot()); if (!docBase.exists()) { docBase.mkdirs(); } context.setDocBase(docBase.getPath()); final Loader loader = new WebCtxLoader(unit.getAttachment(WSAttachmentKeys.CLASSLOADER_KEY)); loader.setContainer(host); context.setLoader(loader); context.setInstanceManager(new LocalInstanceManager()); addServlets(jbwebMD, context); host.addChild(context); context.create(); } catch (Exception e) { throw MESSAGES.createContextPhaseFailed(e); } try { context.start(); } catch (LifecycleException e) { throw MESSAGES.startContextPhaseFailed(e); } return context; }
context.setJ2EEApplication("OFBiz"); context.setJ2EEServer("OFBiz Container"); context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader())); context.setDocBase(location); context.setReloadable(ContainerConfig.getPropertyValue(configuration, "apps-context-reloadable", false));
WebappLoader webappLoader = new WebappLoader(getParentClassLoader()); webappLoader.setDelegate(getDelegate()); setLoader(webappLoader);
WebappLoader webappLoader = new WebappLoader(getParentClassLoader()); webappLoader.setDelegate(getDelegate()); setLoader(webappLoader);