Exemplo n.º 1
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;
    }
  }
Exemplo n.º 2
0
  /** Finds the web-app for the entry. */
  private WebAppUriMap findByURIImpl(String subURI) {
    WebAppUriMap entry = _uriToAppCache.get(subURI);

    if (entry != null) {
      return entry;
    }

    int length = subURI.length();
    int p = subURI.lastIndexOf('/');

    if (p < 0 || p < length - 1) { // server/26cf
      WebAppController controller = _appDeploy.findController(subURI);

      if (controller != null) {
        entry = new WebAppUriMap(subURI, controller);

        _uriToAppCache.put(subURI, entry);

        return entry;
      }
    }

    if (p >= 0) {
      entry = findByURIImpl(subURI.substring(0, p));

      if (entry != null) _uriToAppCache.put(subURI, entry);
    }

    return entry;
  }
Exemplo n.º 3
0
 /** Starts the container. */
 public void start() {
   try {
     _appDeploy.start();
   } catch (Exception e) {
     throw ConfigException.create(e);
   }
 }
Exemplo n.º 4
0
  public void addWebApp(WebAppSingleDeployGenerator deployGenerator) {
    deployGenerator.deploy();

    _appDeploy.add(deployGenerator);

    clearCache();
  }
Exemplo n.º 5
0
  /** Adds an webApp. */
  public void addWebApp(WebAppConfig config) {
    if (config.getURLRegexp() != null) {
      DeployGenerator<WebAppController> deploy =
          new WebAppRegexpDeployGenerator(_appDeploySpi, this, config);
      _appDeploy.add(deploy);

      clearCache();
      return;
    }

    // server/10f6
    /*
    WebAppController oldEntry
      = _appDeploy.findController(config.getContextPath());

    if (oldEntry != null && oldEntry.getSourceType().equals("single")) {
      throw new ConfigException(L.l("duplicate web-app '{0}' forbidden.",
                                    config.getId()));
    }
    */

    WebAppSingleDeployGenerator deployGenerator = createDeployGenerator(config);

    addWebApp(deployGenerator);
  }
Exemplo n.º 6
0
  /** Sets the war-expansion */
  public void addWarDeploy(WebAppExpandDeployGenerator webAppDeploy) throws ConfigException {
    assert webAppDeploy.getContainer() == this;

    if (!_hasWarGenerator) {
      _hasWarGenerator = true;
      _warGenerator = webAppDeploy;
    }

    _appDeploy.add(webAppDeploy);
  }
Exemplo n.º 7
0
  /** Adds the ear-expansion */
  public void addEarDeploy(EarDeployGenerator earDeploy) throws Exception {
    _earDeploy.add(earDeploy);

    // server/26cc - _appDeploy must be added first, because the
    // _earDeploy addition will automaticall register itself
    _appDeploy.add(new WebAppEarDeployGenerator(_appDeploySpi, this, earDeploy));

    /*
    _earDeploy.add(earDeploy);
    */
  }
Exemplo n.º 8
0
  /** Closes the container. */
  public void destroy() {
    _earDeploy.destroy();
    _appDeploy.destroy();

    AbstractAccessLog accessLog = _accessLog;
    _accessLog = null;

    if (accessLog != null) {
      try {
        accessLog.destroy();
      } catch (Exception e) {
        log.log(Level.FINER, e.toString(), e);
      }
    }
  }
Exemplo n.º 9
0
  /** Finds the web-app matching the current entry. */
  public WebAppUriMap findEntryByURI(String uri) {
    if (_appDeploy.isModified()) _uriToAppCache.clear();

    WebAppUriMap entry = _uriToAppCache.get(uri);

    if (entry != null) return entry;

    String cleanUri = uri;
    if (CauchoSystem.isCaseInsensitive()) cleanUri = cleanUri.toLowerCase(Locale.ENGLISH);

    // server/105w
    try {
      cleanUri = getInvocationDecoder().normalizeUri(cleanUri);
    } catch (java.io.IOException e) {
      log.log(Level.FINER, e.toString(), e);
    }

    entry = findByURIImpl(cleanUri);

    _uriToAppCache.put(uri, entry);

    return entry;
  }
Exemplo n.º 10
0
  /** Closes the container. */
  public boolean stop() {
    _earDeploy.stop();
    _appDeploy.stop();

    return true;
  }
Exemplo n.º 11
0
 /** Returns a list of the webApps. */
 public WebAppController[] getWebAppList() {
   return _appDeploy.getControllers();
 }
Exemplo n.º 12
0
 /** Finds the web-app for the entry, not checking for sub-apps. (used by LocalDeployServlet) */
 public WebAppController findController(String subURI) {
   return _appDeploy.findController(subURI);
 }
Exemplo n.º 13
0
 /** Removes a web-app-generator. */
 public void removeWebAppDeploy(DeployGenerator<WebAppController> deploy) {
   _appDeploy.remove(deploy);
 }
Exemplo n.º 14
0
 /** Sets the war-expansion */
 public void addDeploy(DeployGenerator<WebAppController> deploy) throws ConfigException {
   if (deploy instanceof WebAppExpandDeployGenerator)
     addWebAppDeploy((WebAppExpandDeployGenerator) deploy);
   else _appDeploy.add(deploy);
 }
Exemplo n.º 15
0
  /** Removes an webApp. */
  void removeWebApp(WebAppController entry) {
    _appDeploy.remove(entry.getContextPath());

    clearCache();
  }
Exemplo n.º 16
0
 public void removeWebApp(WebAppSingleDeployGenerator deployGenerator) {
   _appDeploy.remove(deployGenerator);
   deployGenerator.destroy();
 }