gpt4 book ai didi

org.apache.catalina.WebResource.getName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 13:37:05 30 4
gpt4 key购买 nike

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

WebResource.getName介绍

[英]See java.io.File#getName().
[中]参见java。伊奥。文件#getName()。

代码示例

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

@Override
public String getName() {
  return webResource.getName();
}

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

@Override
public String getName() {
  return webResource.getName();
}

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

@Override
public String getName() {
  return webResource.getName();
}

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

private void processWebInfLib() {
  WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
  for (WebResource possibleJar : possibleJars) {
    if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
      createWebResourceSet(ResourceSetType.CLASSES_JAR,
          "/WEB-INF/classes", possibleJar.getURL(), "/");
    }
  }
}

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

/**
 * Start the class loader.
 *
 * @exception LifecycleException if a lifecycle error occurs
 */
@Override
public void start() throws LifecycleException {
  state = LifecycleState.STARTING_PREP;
  WebResource classes = resources.getResource("/WEB-INF/classes");
  if (classes.isDirectory() && classes.canRead()) {
    localRepositories.add(classes.getURL());
  }
  WebResource[] jars = resources.listResources("/WEB-INF/lib");
  for (WebResource jar : jars) {
    if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
      localRepositories.add(jar.getURL());
      jarModificationTimes.put(
          jar.getName(), Long.valueOf(jar.getLastModified()));
    }
  }
  state = LifecycleState.STARTED;
}

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

/**
 * Start the class loader.
 *
 * @exception LifecycleException if a lifecycle error occurs
 */
@Override
public void start() throws LifecycleException {
  state = LifecycleState.STARTING_PREP;
  WebResource classes = resources.getResource("/WEB-INF/classes");
  if (classes.isDirectory() && classes.canRead()) {
    localRepositories.add(classes.getURL());
  }
  WebResource[] jars = resources.listResources("/WEB-INF/lib");
  for (WebResource jar : jars) {
    if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
      localRepositories.add(jar.getURL());
      jarModificationTimes.put(
          jar.getName(), Long.valueOf(jar.getLastModified()));
    }
  }
  state = LifecycleState.STARTED;
}

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

if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
  try {
    File dest = new File(expansionTarget, possibleJar.getName());
    dest = dest.getCanonicalFile();
    try (InputStream sourceStream = possibleJar.getInputStream();
  } catch (IOException ioe) {
    throw new LifecycleException(
        sm.getString("extractingRoot.jarFailed", possibleJar.getName()), ioe);

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

if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
  try {
    File dest = new File(expansionTarget, possibleJar.getName());
    dest = dest.getCanonicalFile();
    try (InputStream sourceStream = possibleJar.getInputStream();
  } catch (IOException ioe) {
    throw new LifecycleException(
        sm.getString("extractingRoot.jarFailed", possibleJar.getName()), ioe);

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

/**
 * Class loader resources are handled by treating JARs in WEB-INF/lib as
 * resource JARs (without the internal META-INF/resources/ prefix) mounted
 * at WEB-INF/classes (rather than the web app root). This enables reuse
 * of the resource handling plumbing.
 *
 * These resources are marked as class loader only so they are only used in
 * the methods that are explicitly defined to return class loader resources.
 * This prevents calls to getResource("/WEB-INF/classes") returning from one
 * or more of the JAR files.
 *
 * @throws LifecycleException If an error occurs that should stop the web
 *                            application from starting
 */
protected void processWebInfLib() throws LifecycleException {
  WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
  for (WebResource possibleJar : possibleJars) {
    if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
      createWebResourceSet(ResourceSetType.CLASSES_JAR,
          "/WEB-INF/classes", possibleJar.getURL(), "/");
    }
  }
}

代码示例来源:origin: stackoverflow.com

final Context currentContext = ctx;
 ContextConfig ctxCfg = new ContextConfig() {
   @Override
   public void lifecycleEvent(LifecycleEvent event) {
     if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
       WebResourceRoot webResourcesRoot = currentContext.getResources();
       String baseDir = Platform.getBaseDir(); // Server Base Directory
       File libDir = new File(baseDir + File.separator + "lib");
       DirResourceSet dirResourceSet = null;
       try {
         dirResourceSet = new DirResourceSet(webResourcesRoot, "/WEB-INF/lib", libDir.getCanonicalPath(), "/");
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
       webResourcesRoot.addPostResources(dirResourceSet);
       String[] possibleJars = dirResourceSet.list("/WEB-INF/lib");
       for(String libfile : possibleJars) {
         WebResource possibleJar = dirResourceSet.getResource("/WEB-INF/lib/"+libfile);
         System.err.println(String.format("Loading possible jar %s",possibleJar.getCanonicalPath())); // Just checking...
         if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
           WebResourceSet resourceSet = new JarResourceSet(webResourcesRoot, "/WEB-INF/classes", possibleJar.getCanonicalPath(),"/");
           webResourcesRoot.addPostResources(resourceSet);
         }
       }
     }
     super.lifecycleEvent(event);
   }
 };
 ctx.addLifecycleListener(ctxCfg);

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

/**
 * Class loader resources are handled by treating JARs in WEB-INF/lib as
 * resource JARs (without the internal META-INF/resources/ prefix) mounted
 * at WEB-INF/classes (rather than the web app root). This enables reuse
 * of the resource handling plumbing.
 *
 * These resources are marked as class loader only so they are only used in
 * the methods that are explicitly defined to return class loader resources.
 * This prevents calls to getResource("/WEB-INF/classes") returning from one
 * or more of the JAR files.
 *
 * @throws LifecycleException If an error occurs that should stop the web
 *                            application from starting
 */
protected void processWebInfLib() throws LifecycleException {
  WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
  for (WebResource possibleJar : possibleJars) {
    if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
      createWebResourceSet(ResourceSetType.CLASSES_JAR,
          "/WEB-INF/classes", possibleJar.getURL(), "/");
    }
  }
}

代码示例来源:origin: stackoverflow.com

for (WebResource jar : jars) {
  if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {

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

protected void processClasses(WebXml webXml, Set<WebXml> orderedFragments) {
  // Step 4. Process /WEB-INF/classes for annotations and
  // @HandlesTypes matches
  Map<String, JavaClassCacheEntry> javaClassCache = new HashMap<>();
  if (ok) {
    WebResource[] webResources =
        context.getResources().listResources("/WEB-INF/classes");
    for (WebResource webResource : webResources) {
      // Skip the META-INF directory from any JARs that have been
      // expanded in to WEB-INF/classes (sometimes IDEs do this).
      if ("META-INF".equals(webResource.getName())) {
        continue;
      }
      processAnnotationsWebResource(webResource, webXml,
          webXml.isMetadataComplete(), javaClassCache);
    }
  }
  // Step 5. Process JARs for annotations and
  // @HandlesTypes matches - only need to process those fragments we
  // are going to use (remember orderedFragments includes any
  // container fragments)
  if (ok) {
    processAnnotations(
        orderedFragments, webXml.isMetadataComplete(), javaClassCache);
  }
  // Cache, if used, is no longer required so clear it
  javaClassCache.clear();
}

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

/**
 * Start the class loader.
 *
 * @exception LifecycleException if a lifecycle error occurs
 */
@Override
public void start() throws LifecycleException {
  WebResource classes = resources.getResource("/WEB-INF/classes");
  if (classes.isDirectory() && classes.canRead()) {
    addURL(classes.getURL());
  }
  WebResource[] jars = resources.listResources("/WEB-INF/lib");
  for (WebResource jar : jars) {
    if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
      addURL(jar.getURL());
      jarModificationTimes.put(
          jar.getName(), Long.valueOf(jar.getLastModified()));
    }
  }
  started = true;
  String encoding = null;
  try {
    encoding = System.getProperty("file.encoding");
  } catch (SecurityException e) {
    return;
  }
  if (encoding.indexOf("EBCDIC")!=-1) {
    needConvert = true;
  }
}

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

resource.getContentLength(), getServletContext().getMimeType(resource.getName()),
resource.getETag());

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

resource.getContentLength(), getServletContext().getMimeType(resource.getName()),
resource.getETag());

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

if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
  jarCount++;
  Long recordedLastModified = jarModificationTimes.get(jar.getName());
  if (recordedLastModified == null) {

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

webResource.getName().endsWith(".class")) {
InputStream is = null;
try {

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

protected void processAnnotationsWebResource(WebResource webResource,
    WebXml fragment, boolean handlesTypesOnly,
    Map<String,JavaClassCacheEntry> javaClassCache) {
  if (webResource.isDirectory()) {
    WebResource[] webResources =
        webResource.getWebResourceRoot().listResources(
            webResource.getWebappPath());
    if (webResources.length > 0) {
      if (log.isDebugEnabled()) {
        log.debug(sm.getString(
            "contextConfig.processAnnotationsWebDir.debug",
            webResource.getURL()));
      }
      for (WebResource r : webResources) {
        processAnnotationsWebResource(r, fragment, handlesTypesOnly, javaClassCache);
      }
    }
  } else if (webResource.isFile() &&
      webResource.getName().endsWith(".class")) {
    try (InputStream is = webResource.getInputStream()) {
      processAnnotationsStream(is, fragment, handlesTypesOnly, javaClassCache);
    } catch (IOException e) {
      log.error(sm.getString("contextConfig.inputStreamWebResource",
          webResource.getWebappPath()),e);
    } catch (ClassFormatException e) {
      log.error(sm.getString("contextConfig.inputStreamWebResource",
          webResource.getWebappPath()),e);
    }
  }
}

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

protected void processAnnotationsWebResource(WebResource webResource,
    WebXml fragment, boolean handlesTypesOnly,
    Map<String,JavaClassCacheEntry> javaClassCache) {
  if (webResource.isDirectory()) {
    WebResource[] webResources =
        webResource.getWebResourceRoot().listResources(
            webResource.getWebappPath());
    if (webResources.length > 0) {
      if (log.isDebugEnabled()) {
        log.debug(sm.getString(
            "contextConfig.processAnnotationsWebDir.debug",
            webResource.getURL()));
      }
      for (WebResource r : webResources) {
        processAnnotationsWebResource(r, fragment, handlesTypesOnly, javaClassCache);
      }
    }
  } else if (webResource.isFile() &&
      webResource.getName().endsWith(".class")) {
    try (InputStream is = webResource.getInputStream()) {
      processAnnotationsStream(is, fragment, handlesTypesOnly, javaClassCache);
    } catch (IOException e) {
      log.error(sm.getString("contextConfig.inputStreamWebResource",
          webResource.getWebappPath()),e);
    } catch (ClassFormatException e) {
      log.error(sm.getString("contextConfig.inputStreamWebResource",
          webResource.getWebappPath()),e);
    }
  }
}

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