Refine search
@Override public Context createContext(String path, String docBase) { if( log.isDebugEnabled() ) log.debug("Creating context '" + path + "' with docBase '" + docBase + "'"); context = new StandardContext(); context.setDocBase(docBase); context.setPath(path); ContextConfig config = new ContextConfig(); config.setCustomAuthenticators(authenticators); ((Lifecycle) context).addLifecycleListener(config); return (context); }
ctx.setResources(new ArmeriaWebResourceRoot(ctx, config)); ctx.setPath(ROOT_CONTEXT_PATH); ctx.setDocBase(config.docBase().toString()); ctx.addLifecycleListener(TomcatUtil.getDefaultWebXmlListener()); ctx.setConfigFile(TomcatUtil.getWebAppConfigFile(ROOT_CONTEXT_PATH, config.docBase())); final ContextConfig ctxCfg = new ContextConfig(); ctxCfg.setDefaultWebXml(TomcatUtil.noDefaultWebXmlPath()); ctx.addLifecycleListener(ctxCfg);
/** * Process a "init" event for this Context. */ protected void init() { // Called from StandardContext.init() if (contextDigester == null){ contextDigester = createContextDigester(); contextDigester.getParser(); } if (log.isDebugEnabled()) log.debug(sm.getString("contextConfig.init")); context.setConfigured(false); ok = true; contextConfig(); try { fixDocBase(); } catch (IOException e) { log.error(sm.getString( "contextConfig.fixDocBase", context.getName()), e); } }
/** * Process a "before start" event for this Context. */ protected synchronized void beforeStart() { try { fixDocBase(); } catch (IOException e) { log.error(sm.getString( "contextConfig.fixDocBase", context.getName()), e); } antiLocking(); }
/** * Process the default configuration file, if it exists. */ protected void contextConfig() { if( defaultContextXml==null ) getDefaultContextXml(); if (!context.getOverride()) { processContextConfig(new File(getBaseDir()), defaultContextXml); } if (context.getConfigFile() != null) processContextConfig(new File(context.getConfigFile()), null); }
if (log.isDebugEnabled()) { log.debug(sm.getString("contextConfig.start")); if (log.isDebugEnabled()) { log.debug(sm.getString("contextConfig.xmlSettings", context.getName(), Boolean.valueOf(context.getXmlValidation()), Boolean.valueOf(context.getXmlNamespaceAware()))); webConfig(); if (!context.getIgnoreAnnotations()) { applicationAnnotationsConfig(); validateSecurityRoles(); authenticatorConfig(); context.setConfigured(true); } else { log.error(sm.getString("contextConfig.unavailable")); context.setConfigured(false);
private StandardContext startWebApp(Host host) throws Exception { StandardContext context = new StandardContext(); try { context.setPath(contextRoot); context.addLifecycleListener(new ContextConfig()); File docBase = new File(serverTempDir, contextRoot); if (!docBase.exists()) { context.addServletMapping(urlPattern, servletName); host.addChild(context); context.create(); } catch (Exception e) {
public Context addWebapp( Host host, String url, String name, String path ) { Context ctx = new StandardContext(); ctx.setName( name ); ctx.setPath( url ); ctx.setDocBase( path ); ContextConfig ctxCfg = new ContextConfig(); ctx.addLifecycleListener( ctxCfg ); ctxCfg.setDefaultWebXml( new File( configurationDir, "conf/web.xml" ).getAbsolutePath() ); if ( host == null ) { getHost().addChild( ctx ); } else { host.addChild( ctx ); } return ctx; } }
context = (Context) event.getLifecycle(); } catch (ClassCastException e) { log.error(sm.getString("contextConfig.cce", event.getLifecycle()), e); return; configureStart(); } else if (event.getType().equals(Lifecycle.BEFORE_START_EVENT)) { beforeStart(); } else if (event.getType().equals(Lifecycle.AFTER_START_EVENT)) { context.setDocBase(originalDocBase); configureStop(); } else if (event.getType().equals(Lifecycle.AFTER_INIT_EVENT)) { init(); } else if (event.getType().equals(Lifecycle.AFTER_DESTROY_EVENT)) { destroy();
StandardContext context = new StandardContext(); path = getPathStr(path); context.setPath(path); context.setDocBase(docBase); context.setXmlValidation(xmlValidation); context.setXmlNamespaceAware(xmlNamespaceAware); ContextConfig contextConfig = new ContextConfig(); context.addLifecycleListener(contextConfig); new String [] {"java.lang.String"}); } else { log.warn("Deployer not found for "+pname.getKeyProperty("host")); Service service = getService(pname); Engine engine = service.getContainer(); Host host = (Host) engine.findChild(pname.getKeyProperty("host")); host.addChild(context);
/** * Process a "init" event for this Context. */ protected void init() { // Called from StandardContext.init() Digester contextDigester = createContextDigester(); contextDigester.getParser(); if (log.isDebugEnabled()) log.debug(sm.getString("contextConfig.init")); context.setConfigured(false); ok = true; contextConfig(contextDigester); createWebXmlDigester(context.getXmlNamespaceAware(), context.getXmlValidation()); try { fixDocBase(); } catch (IOException e) { log.error(sm.getString( "contextConfig.fixDocBase", context.getName()), e); } }
/** * Process the default configuration file, if it exists. */ protected void contextConfig() { // Open the default web.xml file, if it exists if( defaultContextXml==null && context instanceof StandardContext ) { defaultContextXml = ((StandardContext)context).getDefaultContextXml(); } // set the default if we don't have any overrides if( defaultContextXml==null ) getDefaultContextXml(); if (!context.getOverride()) { processContextConfig(new File(getBaseDir()), defaultContextXml); processContextConfig(getConfigBase(), getHostConfigPath(Constants.HostContextXml)); } if (context.getConfigFile() != null) processContextConfig(new File(context.getConfigFile()), null); }
StandardContext serverContext = (StandardContext) host.findChild("/" + context); if (serverContext == null) { serverContext = new StandardContext(); serverContext.setPath("/" + context); File docBase = new File(SERVER_TEMP_DIR, context); if (!docBase.exists()) { serverContext.setDocBase(docBase.getPath()); serverContext.addLifecycleListener(new ContextConfig()); host.addChild(serverContext); serverContext.create(); serverContext.start();
public Context addWebapp(Host host, String url, String path) { silence(url); Context ctx = new StandardContext(); ctx.setPath( url ); ctx.setDocBase(path); if (defaultRealm == null) { initSimpleAuth(); } ctx.setRealm(defaultRealm); ctx.addLifecycleListener(new DefaultWebXmlListener()); ContextConfig ctxCfg = new ContextConfig(); ctx.addLifecycleListener(ctxCfg); // prevent it from looking ( if it finds one - it'll have dup error ) ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML"); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
/** * Process a "init" event for this Context. */ protected synchronized void init() { // Called from StandardContext.init() Digester contextDigester = createContextDigester(); contextDigester.getParser(); if (log.isDebugEnabled()) { log.debug(sm.getString("contextConfig.init")); } context.setConfigured(false); ok = true; contextConfig(contextDigester); }
Host host = (Host) context.getParent(); String appBase = host.getAppBase(); boolean unpackWARs = true; if (host instanceof StandardHost) { unpackWARs = ((StandardHost) host).isUnpackWARs() && ((StandardContext) context).getUnpackWAR(); appBase).getCanonicalFile(); String docBase = context.getDocBase(); if (docBase == null) { String path = context.getPath(); if (path == null) { return; context.setDocBase(docBase); } else { super.fixDocBase();
private Context createDefaultContext(String contextPath, String docBase) { StandardContext context = new StandardContext(); context.setDocBase(docBase); context.setPath(contextPath); ContextConfig config = new ContextConfig(); context.addLifecycleListener(config); return context; }
/** * Process a "init" event for this Context. */ protected void init() { // Called from StandardContext.init() Digester contextDigester = createContextDigester(); contextDigester.getParser(); if (log.isDebugEnabled()) { log.debug(sm.getString("contextConfig.init")); } context.setConfigured(false); ok = true; contextConfig(contextDigester); webXmlParser = new WebXmlParser(context.getXmlNamespaceAware(), context.getXmlValidation(), context.getXmlBlockExternal()); }
@Override public Context addWebapp(Host host, String contextPath, String docBase, LifecycleListener config) { // quit because of private and unneeded //silence(host, contextPath); final Context ctx = createContext(host, contextPath); ctx.setPath(contextPath); ctx.setDocBase(docBase); ctx.addLifecycleListener(newDefaultWebXmlListener()); // *extension point ctx.setConfigFile(getWebappConfigFile(docBase, contextPath)); ctx.addLifecycleListener(config); if (config instanceof ContextConfig) { // prevent it from looking ( if it finds one - it'll have dup error ) ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath()); } if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
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; }