private static StandardContext addContext(Tomcat tomcat, String contextPath, File dir) { try { StandardContext context = (StandardContext) tomcat.addWebapp(contextPath, dir.getAbsolutePath()); context.setClearReferencesHttpClientKeepAliveThread(false); context.setClearReferencesStopThreads(false); context.setClearReferencesStopTimerThreads(false); context.setClearReferencesStopTimerThreads(false); context.setAntiResourceLocking(false); context.setReloadable(false); context.setUseHttpOnly(true); context.setTldValidation(false); context.setXmlValidation(false); context.setXmlNamespaceAware(false); context.setUseNaming(false); context.setDelegate(true); context.setJarScanner(new NullJarScanner()); context.setAllowCasualMultipartParsing(true); context.setCookies(false); // disable JSP and WebSocket support context.setContainerSciFilter("org.apache.tomcat.websocket.server.WsSci|org.apache.jasper.servlet.JasperInitializer"); return context; } catch (ServletException e) { throw new IllegalStateException("Fail to configure webapp from " + dir, e); } }
private static StandardContext addContext(Tomcat tomcat, String contextPath, File dir) { try { StandardContext context = (StandardContext) tomcat.addWebapp(contextPath, dir.getAbsolutePath()); context.setClearReferencesHttpClientKeepAliveThread(false); context.setClearReferencesStopThreads(false); context.setClearReferencesStopTimerThreads(false); context.setClearReferencesStopTimerThreads(false); context.setAntiResourceLocking(false); context.setReloadable(false); context.setUseHttpOnly(true); context.setTldValidation(false); context.setXmlValidation(false); context.setXmlNamespaceAware(false); context.setUseNaming(false); context.setDelegate(true); context.setJarScanner(new NullJarScanner()); context.setAllowCasualMultipartParsing(true); context.setCookies(false); // disable JSP and WebSocket support context.setContainerSciFilter("org.apache.tomcat.websocket.server.WsSci|org.apache.jasper.servlet.JasperInitializer"); return context; } catch (ServletException e) { throw new IllegalStateException("Fail to configure webapp from " + dir, e); } }
context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader())); context.setDocBase(location); context.setReloadable(ContainerConfig.getPropertyValue(configuration, "apps-context-reloadable", false)); context.setDistributable(contextIsDistributable); context.setCrossContext(ContainerConfig.getPropertyValue(configuration, "apps-cross-context", true));
final ContextInfo ctxInfo = getContextInfo(standardContext); if (ctxInfo == null || (ctxInfo.appInfo != null && ctxInfo.appInfo.webAppAlone)) { // don't do it for ears standardContext.setReloadable(true);