public void deployWebApps(AppInfo appInfo, ClassLoader classLoader) throws Exception { for (WebAppInfo webApp : appInfo.webApps) { if (getContextInfo(webApp) == null) { StandardContext standardContext = new StandardContext(); String contextXmlFile = webApp.codebase + "/META-INF/context.xml"; if (new File(contextXmlFile).exists()) { standardContext.setConfigFile(contextXmlFile); standardContext.setOverride(true); } ContextConfig contextConfig = new ContextConfig(); standardContext.addLifecycleListener(contextConfig); standardContext.setPath("/" + webApp.contextRoot); standardContext.setDocBase(webApp.codebase); standardContext.setParentClassLoader(classLoader); standardContext.setDelegate(true); String host = webApp.host; if (host == null) host = "localhost"; HostConfig deployer = deployers.get(host); if (deployer != null) { // host isn't set until we call deployer.manageApp, so pass it ContextInfo contextInfo = addContextInfo(host, standardContext); contextInfo.appInfo = appInfo; contextInfo.deployer = deployer; contextInfo.standardContext = standardContext; deployer.manageApp(standardContext); } } } }
if (contextXmlFile.exists()) { BackportUtil.getAPI().setConfigFile(standardContext, contextXmlFile); standardContext.setOverride(true);