public class ServletContextResourcePatternResolver extends PathMatchingResourcePatternResolver
PathMatchingResourcePatternResolver
,
able to find matching resources below the web application root directory
via ServletContext.getResourcePaths(java.lang.String)
. Falls back to the superclass'
file system checking for other resources.CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
Constructor and Description |
---|
ServletContextResourcePatternResolver(ResourceLoader resourceLoader)
Create a new ServletContextResourcePatternResolver.
|
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. |
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, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, resolveRootDirResource, retrieveMatchingFiles, setPathMatcher
public ServletContextResourcePatternResolver(ServletContext servletContext)
servletContext
- the ServletContext to load resources withServletContextResourceLoader.ServletContextResourceLoader(javax.servlet.ServletContext)
public ServletContextResourcePatternResolver(ResourceLoader resourceLoader)
resourceLoader
- the ResourceLoader to load root directories and
actual resources withprotected 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 PathMatchingResourcePatternResolver
rootDirResource
- the root directory as ResourcesubPattern
- the sub pattern to match (below the root directory)java.io.IOException
- in case of I/O errorsdoRetrieveMatchingServletContextResources(javax.servlet.ServletContext, java.lang.String, java.lang.String, java.util.Set<org.springframework.core.io.Resource>)
,
ServletContextResource
,
ServletContext.getResourcePaths(java.lang.String)
protected 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
,
ServletContext.getResourcePaths(java.lang.String)