/** Returns the webApp for the current request. */ private WebApp getWebApp( Invocation invocation, WebAppController controller, boolean isTopRequest) { try { if (controller != null) { WebApp webApp; if (isTopRequest) webApp = controller.request(); else webApp = controller.subrequest(); if (webApp == null) { return null; } invocation.setWebApp(webApp); return webApp; } else { return null; } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw ConfigException.create(e); } }
/** Updates a WebApp deploy */ public void updateWebAppDeploy(String name) throws Throwable { _appDeploy.update(); WebAppController controller = _appDeploy.update(name); clearCache(); if (controller != null) { Throwable configException = controller.getConfigException(); if (configException != null) throw configException; } }
/** Creates a sub invocation, handing unmapped URLs and stopped webApps. */ private WebApp buildSubInvocation(Invocation invocation) { if (!_lifecycle.waitForActive(_startWaitTime)) { UnavailableException e; e = new UnavailableException(invocation.getURI()); FilterChain chain = new ExceptionFilterChain(e); invocation.setFilterChain(chain); invocation.setDependency(AlwaysModified.create()); return null; } WebAppController appController = getWebAppController(invocation); if (appController == null) { String url = invocation.getURI(); FileNotFoundException e = new FileNotFoundException(url); FilterChain chain = new ExceptionFilterChain(e); invocation.setFilterChain(chain); invocation.setDependency(AlwaysModified.create()); return null; } WebApp webApp = appController.subrequest(); if (webApp == null) { UnavailableException e; e = new UnavailableException(invocation.getURI()); FilterChain chain = new ExceptionFilterChain(e); invocation.setFilterChain(chain); invocation.setDependency(AlwaysModified.create()); return null; } return webApp; }
/** Creates the invocation. */ public WebApp findSubWebAppByURI(String uri) { WebAppController controller = findByURI(uri); if (controller != null) return controller.subrequest(); else return null; }
/** Removes an webApp. */ void removeWebApp(WebAppController entry) { _appDeploy.remove(entry.getContextPath()); clearCache(); }