@Override protected WebResourceSet createMainResourceSet() { final Path docBase = config.docBase(); assert docBase.isAbsolute(); final String docBaseStr = docBase.toString(); getContext().setDocBase(docBaseStr); if (Files.isDirectory(docBase)) { return new DirResourceSet(this, "/", docBaseStr, "/"); } final Optional<String> jarRootOpt = config.jarRoot(); if (jarRootOpt.isPresent()) { // If docBase is a JAR file final String jarRoot = jarRootOpt.get(); if ("/".equals(jarRoot)) { return new JarResourceSet(this, "/", docBaseStr, "/"); } else { return new JarSubsetResourceSet(this, "/", docBaseStr, "/", jarRoot); } } throw new IllegalArgumentException(sm.getString("standardRoot.startInvalidMain", docBaseStr)); } }
ctx.setDocBase(config.docBase().toString()); ctx.addLifecycleListener(TomcatUtil.getDefaultWebXmlListener()); ctx.setConfigFile(TomcatUtil.getWebAppConfigFile(ROOT_CONTEXT_PATH, config.docBase()));
@Override public void lifecycleEvent(LifecycleEvent event) { if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType())) { // The context has stopped. Context context = (Context) event.getLifecycle(); // Remove the old expanded WAR. ExpandWar.delete(toDelete); // Reset the docBase to trigger re-expansion of the WAR. context.setDocBase(newDocBase); // Remove this listener from the Context else it will run every // time the Context is stopped. context.removeLifecycleListener(this); } } }
@Override public void lifecycleEvent(LifecycleEvent event) { if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType())) { // The context has stopped. Context context = (Context) event.getLifecycle(); // Remove the old expanded WAR. ExpandWar.delete(toDelete); // Reset the docBase to trigger re-expansion of the WAR. context.setDocBase(newDocBase); // Remove this listener from the Context else it will run every // time the Context is stopped. context.removeLifecycleListener(this); } } }
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; } }
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( extractDirectory, "conf/web.xml" ).getAbsolutePath() ); if ( host == null ) { getHost().addChild( ctx ); } else { host.addChild( ctx ); } return ctx; } };
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; } }
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( extractDirectory, "conf/web.xml" ).getAbsolutePath() ); if ( host == null ) { getHost().addChild( ctx ); } else { host.addChild( ctx ); } return ctx; } };
public Context addContext(Host host, String contextPath, String dir) { silence(contextPath); Context ctx = new StandardContext(); ctx.setPath( contextPath ); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
public Context addContext(Host host, String contextPath, String dir) { silence(contextPath); Context ctx = new StandardContext(); ctx.setPath( contextPath ); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
public Context addContext(Host host, String contextPath, String dir) { silence(contextPath); Context ctx = new StandardContext(); ctx.setPath( contextPath ); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
public Context addContext(Host host, String contextPath, String contextName, String dir) { silence(host, contextPath); Context ctx = new StandardContext(); ctx.setName(contextName); ctx.setPath(contextPath); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
public Context addContext(Host host, String contextPath, String contextName, String dir) { silence(host, contextPath); Context ctx = new StandardContext(); ctx.setName(contextName); ctx.setPath(contextPath); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
/** * @see #addContext(String, String) */ public Context addContext(Host host, String contextPath, String contextName, String dir) { silence(host, contextPath); Context ctx = new StandardContext(); ctx.setName(contextName); ctx.setPath(contextPath); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
/** * @param host The host in which the context will be deployed * @param contextPath The context mapping to use, "" for root context. * @param contextName The context name * @param dir Base directory for the context, for static files. * Must exist, relative to the server home * @return the deployed context * @see #addContext(String, String) */ public Context addContext(Host host, String contextPath, String contextName, String dir) { silence(host, contextName); Context ctx = createContext(host, contextPath); ctx.setName(contextName); ctx.setPath(contextPath); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
@Override public Context addWebapp(Host host, String url, String name, String path) { Context ctx = new StandardContext(); ctx.setName(name); ctx.setPath(url); ctx.setDocBase(path); ctx.addLifecycleListener(new DefaultWebXmlListener()); URL configFile = getWebappConfigFile(path, url); ctx.setConfigFile(configFile); ContextConfig ctxCfg = new TomcatContextConfig(); ctx.addLifecycleListener(ctxCfg); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
@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; }
public Context addWebapp(Host host, String url, String name, String path) { silence(host, url); Context ctx = new StandardContext(); ctx.setName(name); ctx.setPath(url); ctx.setDocBase(path); 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(noDefaultWebXmlPath()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
public Context addWebapp(Host host, String url, String name, String path) { silence(host, url); Context ctx = new StandardContext(); ctx.setName(name); ctx.setPath(url); ctx.setDocBase(path); 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(noDefaultWebXmlPath()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
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; }