public class ServletContextResourcePatternResolver extends PathMatchingResourcePatternResolver
PathMatchingResourcePatternResolver,
able to find matching resources below the web application root directory
via ServletContext#getResourcePaths. Falls back to the superclass'
file system checking for other resources.| Modifier and Type | Field and Description |
|---|---|
private static Log |
logger |
CLASSPATH_ALL_URL_PREFIXCLASSPATH_URL_PREFIX| Constructor and Description |
|---|
ServletContextResourcePatternResolver(ServletContext servletContext)
Create a new ServletContextResourcePatternResolver.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Set<Resource> |
doFindPathMatchingFileResources(Resource rootDirResource,
java.lang.String subPattern)
Overridden version which checks for ServletContextResource
and uses
ServletContext.getResourcePaths to find
matching resources below the web application root directory. |
private void |
doRetrieveMatchingJarEntries(java.lang.String jarFilePath,
java.lang.String entryPattern,
java.util.Set<Resource> result)
Extract entries from the given jar by pattern.
|
protected void |
doRetrieveMatchingServletContextResources(ServletContext servletContext,
java.lang.String fullPattern,
java.lang.String dir,
java.util.Set<Resource> result)
Recursively retrieve ServletContextResources that match the given pattern,
adding them to the given result set.
|
addAllClassLoaderJarRoots, addClassPathManifestEntries, convertClassLoaderURL, determineRootDir, doFindAllClassPathResources, doFindMatchingFileSystemResources, doFindPathMatchingJarResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, resolveRootDirResource, retrieveMatchingFiles, setPathMatcherpublic ServletContextResourcePatternResolver(ServletContext servletContext)
servletContext - the ServletContext to load resources withServletContextResourceLoader#ServletContextResourceLoader(javax.servlet.ServletContext)protected java.util.Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, java.lang.String subPattern) throws java.io.IOException
ServletContext.getResourcePaths to find
matching resources below the web application root directory.
In case of other resources, delegates to the superclass version.doFindPathMatchingFileResources in class PathMatchingResourcePatternResolverrootDirResource - the root directory as ResourcesubPattern - the sub pattern to match (below the root directory)java.io.IOException - in case of I/O errorsdoRetrieveMatchingServletContextResources(ServletContext, java.lang.String, java.lang.String, java.util.Set<org.springframework.core.io.Resource>),
ServletContextResource,
javax.servlet.ServletContext#getResourcePathsprotected void doRetrieveMatchingServletContextResources(ServletContext servletContext,
java.lang.String fullPattern,
java.lang.String dir,
java.util.Set<Resource> result)
throws java.io.IOException
servletContext - the ServletContext to work onfullPattern - the pattern to match against,
with preprended root directory pathdir - the current directoryresult - the Set of matching Resources to add tojava.io.IOException - if directory contents could not be retrievedServletContextResource,
javax.servlet.ServletContext#getResourcePathsprivate void doRetrieveMatchingJarEntries(java.lang.String jarFilePath,
java.lang.String entryPattern,
java.util.Set<Resource> result)
jarFilePath - the path to the jar fileentryPattern - the pattern for jar entries to matchresult - the Set of matching Resources to add to