コード例 #1
0
ファイル: FileResourceSet.java プロジェクト: faicm/tomcat
  @Override
  public Set<String> listWebAppPaths(String path) {
    checkPath(path);

    ResourceSet<String> result = new ResourceSet<>();

    if (path.charAt(path.length() - 1) != '/') {
      path = path + '/';
    }
    String webAppMount = getWebAppMount();

    if (webAppMount.startsWith(path)) {
      webAppMount = webAppMount.substring(path.length());
      if (webAppMount.equals(getFileBase().getName())) {
        result.add(path + getFileBase().getName());
      } else {
        // Virtual directory
        int i = webAppMount.indexOf('/');
        if (i > 0) {
          result.add(path + webAppMount.substring(0, i + 1));
        }
      }
    }

    result.setLocked(true);
    return result;
  }
コード例 #2
0
  /**
   * Internal implementation of getResourcesPath() logic.
   *
   * @param resources Directory context to search
   * @param path Collection path
   */
  private Set getResourcePathsInternal(DirContext resources, String path) {

    ResourceSet set = new ResourceSet();
    try {
      listCollectionPaths(set, resources, path);
    } catch (NamingException e) {
      return (null);
    }
    set.setLocked(true);
    return (set);
  }