gpt4 book ai didi

org.apache.catalina.WebResourceSet类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 00:55:05 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.catalina.WebResourceSet类的一些代码示例,展示了WebResourceSet类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebResourceSet类的具体详情如下:
包路径:org.apache.catalina.WebResourceSet
类名称:WebResourceSet

WebResourceSet介绍

[英]Represents a set of resources that are part of a web application. Examples include a directory structure, a resources JAR and a WAR file.
[中]表示web应用程序中的一组资源。示例包括目录结构、资源JAR和WAR文件。

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public URL getBaseUrl() {
  return this.delegate.getBaseUrl();
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public WebResource getResource(String path) {
  if (path.startsWith("/org/springframework/boot")) {
    return new EmptyResource(getRoot(), path);
  }
  return this.delegate.getResource(path);
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public String[] list(String path) {
  return this.delegate.list(path);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public List<URL> getBaseUrls() {
  List<URL> result = new ArrayList<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!webResourceSet.getClassLoaderOnly()) {
        URL url = webResourceSet.getBaseUrl();
        if (url != null) {
          result.add(url);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

for (final WebResourceSet[] sets : asList(webResources.getPreResources(), webResources.getPostResources(), webResources.getJarResources())) {
  for (final WebResourceSet wr : sets) {
    final URL base = wr.getBaseUrl();
    if (base != null) {
      final File baseFile = URLs.toFile(base);
      if (baseFile.isDirectory()) {
        final String[] libs = wr.list("/WEB-INF/lib/");
        if (libs != null) {
          for (final String resource : libs) {
        final WebResource classes = wr.getResource("/WEB-INF/classes/");
        if (classes != null) {
          final String path = classes.getCanonicalPath();
      } else if (baseFile.exists() && baseFile.getName().endsWith(".jar") && wr.getResource("/WEB-INF/classes/").exists()) {
        try {
          cp.add(baseFile.getCanonicalPath());

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

protected WebResource[] getResourcesInternal(String path,
    boolean useClassLoaderResources) {
  List<WebResource> result = new ArrayList<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (useClassLoaderResources || !webResourceSet.getClassLoaderOnly()) {
        WebResource webResource = webResourceSet.getResource(path);
        if (webResource.exists()) {
          result.add(webResource);
        }
      }
    }
  }
  if (result.size() == 0) {
    result.add(main.getResource(path));
  }
  return result.toArray(new WebResource[result.size()]);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

protected final WebResource getResourceInternal(String path,
    boolean useClassLoaderResources) {
  WebResource result = null;
  WebResource virtual = null;
  WebResource mainEmpty = null;
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!useClassLoaderResources &&  !webResourceSet.getClassLoaderOnly() ||
          useClassLoaderResources && !webResourceSet.getStaticOnly()) {
        result = webResourceSet.getResource(path);
        if (result.exists()) {
          return result;
        }
        if (virtual == null) {
          if (result.isVirtual()) {
            virtual = result;
          } else if (main.equals(webResourceSet)) {
            mainEmpty = result;
          }
        }
      }
    }
  }
  // Use the first virtual result if no real result was found
  if (virtual != null) {
    return virtual;
  }
  // Default is empty resource in main resources
  return mainEmpty;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

private String[] list(String path, boolean validate) {
  if (validate) {
    path = validate(path);
  }
  // Set because we don't want duplicates
  // LinkedHashSet to retain the order. It is the order of the
  // WebResourceSet that matters but it is simpler to retain the order
  // over all of the JARs.
  HashSet<String> result = new LinkedHashSet<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!webResourceSet.getClassLoaderOnly()) {
        String[] entries = webResourceSet.list(path);
        for (String entry : entries) {
          result.add(entry);
        }
      }
    }
  }
  return result.toArray(new String[result.size()]);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public Set<String> listWebAppPaths(String path) {
  path = validate(path);
  // Set because we don't want duplicates
  Set<String> result = new HashSet<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!webResourceSet.getClassLoaderOnly()) {
        result.addAll(webResourceSet.listWebAppPaths(path));
      }
    }
  }
  if (result.size() == 0) {
    return null;
  }
  return result;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

for (List<WebResourceSet> list : allResources) {
  for (WebResourceSet webResourceSet : list) {
    webResourceSet.stop();
  main.destroy();
  webResourceSet.destroy();
  webResourceSet.destroy();

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public boolean mkdir(String path) {
  return this.delegate.mkdir(path);
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public boolean write(String path, InputStream is, boolean overwrite) {
  return this.delegate.write(path, is, overwrite);
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public Set<String> listWebAppPaths(String path) {
  return this.delegate.listWebAppPaths(path);
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public void gc() {
  this.delegate.gc();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
protected void destroyInternal() throws LifecycleException {
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      webResourceSet.destroy();
    }
  }
  unregister(cacheJmxName);
  super.destroyInternal();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
protected void initInternal() throws LifecycleException {
  super.initInternal();
  cacheJmxName = register(cache, getObjectNameKeyProperties() + ",name=Cache");
  registerURLStreamHandlerFactory();
  if (context == null) {
    throw new IllegalStateException(
        sm.getString("standardRoot.noContext"));
  }
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      webResourceSet.init();
    }
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public List<URL> getBaseUrls() {
  List<URL> result = new ArrayList<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!webResourceSet.getClassLoaderOnly()) {
        URL url = webResourceSet.getBaseUrl();
        if (url != null) {
          result.add(url);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected WebResource[] getResourcesInternal(String path,
    boolean useClassLoaderResources) {
  List<WebResource> result = new ArrayList<>();
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (useClassLoaderResources || !webResourceSet.getClassLoaderOnly()) {
        WebResource webResource = webResourceSet.getResource(path);
        if (webResource.exists()) {
          result.add(webResource);
        }
      }
    }
  }
  if (result.size() == 0) {
    result.add(main.getResource(path));
  }
  return result.toArray(new WebResource[result.size()]);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected final WebResource getResourceInternal(String path,
    boolean useClassLoaderResources) {
  WebResource result = null;
  WebResource virtual = null;
  WebResource mainEmpty = null;
  for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!useClassLoaderResources &&  !webResourceSet.getClassLoaderOnly() ||
          useClassLoaderResources && !webResourceSet.getStaticOnly()) {
        result = webResourceSet.getResource(path);
        if (result.exists()) {
          return result;
        }
        if (virtual == null) {
          if (result.isVirtual()) {
            virtual = result;
          } else if (main.equals(webResourceSet)) {
            mainEmpty = result;
          }
        }
      }
    }
  }
  // Use the first virtual result if no real result was found
  if (virtual != null) {
    return virtual;
  }
  // Default is empty resource in main resources
  return mainEmpty;
}

代码示例来源:origin: codefollower/Tomcat-Research

private String[] list(String path, boolean validate) {
  if (validate) {
    path = validate(path);
  }
  // Set because we don't want duplicates
  // LinkedHashSet to retain the order. It is the order of the
  // WebResourceSet that matters but it is simpler to retain the order
  // over all of the JARs.
  HashSet<String> result = new LinkedHashSet<>();
  for (ArrayList<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
      if (!webResourceSet.getClassLoaderOnly()) {
        String[] entries = webResourceSet.list(path);
        for (String entry : entries) {
          result.add(entry);
        }
      }
    }
  }
  return result.toArray(new String[result.size()]);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com