Java 类org.apache.catalina.WebResource 实例源码

项目:RAFTools    文件:NIOResourceRoot.java   
@Override
public WebResource[] getResources(String path) {
    Path _path = rootPath.resolve(rootPath);

    if(!Files.exists(_path)) {
        return new WebResource[0];
    }

    if(!Files.isDirectory(_path)) {
        return new WebResource[] {
            createResource(_path)
        };
    }

    return listResources(path);
}
项目:psi-probe    文件:Tomcat80ContainerAdapter.java   
@Override
public Long[] getResourceAttributes(String name, Context context) {
  Long[] result = new Long[2];
  WebResource resource = context.getResources().getResource(name);
  result[0] = resource.getContentLength();
  result[1] = resource.getLastModified();
  return result;
}
项目:psi-probe    文件:Tomcat90ContainerAdapter.java   
@Override
public Long[] getResourceAttributes(String name, Context context) {
  Long[] result = new Long[2];
  WebResource resource = context.getResources().getResource(name);
  result[0] = resource.getContentLength();
  result[1] = resource.getLastModified();
  return result;
}
项目:psi-probe    文件:Tomcat85ContainerAdapter.java   
@Override
public Long[] getResourceAttributes(String name, Context context) {
  Long[] result = new Long[2];
  WebResource resource = context.getResources().getResource(name);
  result[0] = resource.getContentLength();
  result[1] = resource.getLastModified();
  return result;
}
项目:RAFTools    文件:NIOResourceRoot.java   
@Override
public WebResource[] listResources(String path) {
    Path[] children = listDirectory(rootPath.resolve(path));
    WebResource[] res = new WebResource[children.length];

    for(int i = 0; i < children.length; ++i) {
        res[i] = createResource(children[i]);
    }

    return res;
}
项目:RAFTools    文件:RAFSResourceRoot.java   
@Override
public WebResource getResource(String path) {
    logger.debug("Request for resource: %s", path);
    if(path.startsWith("/META-INF") || path.startsWith("/WEB-INF")) {
        logger.debug("  Forbidden path, returning empty");
        return new EmptyResource(this, path);
    }

    return super.getResource(path);
}
项目:RAFTools    文件:RAFSResourceRoot.java   
@Override
public WebResource[] listResources(String path) {
    if(path.startsWith("/META-INF") || path.startsWith("/WEB-INF")) {
        logger.debug("  Forbidden path, returning empty");
        return new WebResource[0];
    }

    return super.listResources(path);
}
项目:psi-probe-plus    文件:Tomcat80ContainerAdaptor.java   
public Long[] getResourceAttributes(String name, Context context) {
    Long result[] = new Long[2];
    WebResource resource = context.getResources().getResource(name);
    result[0] = resource.getContentLength();
    result[1] = resource.getLastModified();
    return result;
}
项目:joinfaces    文件:MockWebResourceRoot.java   
@Override
public WebResource getResource(String path) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
项目:joinfaces    文件:MockWebResourceRoot.java   
@Override
public WebResource[] getResources(String path) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
项目:joinfaces    文件:MockWebResourceRoot.java   
@Override
public WebResource getClassLoaderResource(String path) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
项目:joinfaces    文件:MockWebResourceRoot.java   
@Override
public WebResource[] getClassLoaderResources(String path) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
项目:joinfaces    文件:MockWebResourceRoot.java   
@Override
public WebResource[] listResources(String path) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
项目:psi-probe    文件:Tomcat80ContainerAdapter.java   
@Override
public InputStream getResourceStream(String name, Context context) throws IOException {
  WebResource resource = context.getResources().getResource(name);
  return resource.getInputStream();
}
项目:psi-probe    文件:Tomcat90ContainerAdapter.java   
@Override
public InputStream getResourceStream(String name, Context context) throws IOException {
  WebResource resource = context.getResources().getResource(name);
  return resource.getInputStream();
}
项目:psi-probe    文件:Tomcat85ContainerAdapter.java   
@Override
public InputStream getResourceStream(String name, Context context) throws IOException {
  WebResource resource = context.getResources().getResource(name);
  return resource.getInputStream();
}
项目:RAFTools    文件:NIOResourceRoot.java   
@Override
public WebResource getResource(String path) {
    return createResource(rootPath.resolve(path));
}
项目:RAFTools    文件:NIOResourceRoot.java   
@Override
public WebResource getClassLoaderResource(String path) {
    return new EmptyResource(this, webAppPath);
}
项目:RAFTools    文件:NIOResourceRoot.java   
@Override
public WebResource[] getClassLoaderResources(String path) {
    return new WebResource[0];
}
项目:tomee    文件:TomEEWebappClassLoader.java   
@Override
public WebResource getResource(final String path) {
    return super.getResource(computePath(path));
}
项目:tomee    文件:LazyStopStandardRoot.java   
@Override
public WebResource getResource(final String path) {
    return delegate.getResource(path);
}
项目:tomee    文件:LazyStopStandardRoot.java   
@Override
public WebResource getClassLoaderResource(final String path) {
    return delegate.getClassLoaderResource(path);
}
项目:tomee    文件:LazyStopStandardRoot.java   
@Override
public WebResource[] getClassLoaderResources(final String path) {
    return delegate.getClassLoaderResources(path);
}
项目:tomee    文件:LazyStopStandardRoot.java   
@Override
public WebResource[] getResources(final String path) {
    return delegate.getResources(path);
}
项目:tomee    文件:LazyStopStandardRoot.java   
@Override
public WebResource[] listResources(final String path) {
    return delegate.listResources(path);
}
项目:tomee    文件:TomcatWebAppBuilder.java   
private static DeploymentLoader.ExternalConfiguration configuredClasspath(final StandardContext standardContext) {
    Loader loader = standardContext.getLoader();
    if (loader != null && LazyStopLoader.class.isInstance(loader)) {
        loader = LazyStopLoader.class.cast(loader).getDelegateLoader();
    }
    if (loader != null) {
        final ClassLoader cl = standardContext.getLoader().getClassLoader();
        if (cl == null) {
            return null;
        }

        final Collection<String> cp = new LinkedList<>();

        final WebResourceRoot webResources = standardContext.getResources();
        if (webResources != null) { // to enhance
            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) {
                                    cp.add(new File(baseFile, resource).getAbsolutePath());
                                }
                            }

                            final WebResource classes = wr.getResource("/WEB-INF/classes/");
                            if (classes != null) {
                                final String path = classes.getCanonicalPath();
                                if (path != null) {
                                    cp.add(path);
                                }
                            }
                        } else if (baseFile.exists() && baseFile.getName().endsWith(".jar") && wr.getResource("/WEB-INF/classes/").exists()) {
                            try {
                                cp.add(baseFile.getCanonicalPath());
                            } catch (final IOException e) {
                                throw new IllegalStateException(e);
                            }
                        }
                    }
                }
            }
        }

        if (!cp.isEmpty()) {
            return new DeploymentLoader.ExternalConfiguration(cp.toArray(new String[cp.size()]), null /*for now doesnt make sense, todo: configure*/);
        }
    }
    return null;
}