Esempio n. 1
0
  /** 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);
    }
  }
Esempio n. 2
0
  /** 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;
    }
  }
Esempio n. 3
0
  /** 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;
  }
Esempio n. 4
0
  /** Creates the invocation. */
  public WebApp findSubWebAppByURI(String uri) {
    WebAppController controller = findByURI(uri);

    if (controller != null) return controller.subrequest();
    else return null;
  }
Esempio n. 5
0
  /** Removes an webApp. */
  void removeWebApp(WebAppController entry) {
    _appDeploy.remove(entry.getContextPath());

    clearCache();
  }