Class ServletContextResourcePatternResolver
java.lang.Object
org.springframework.core.io.support.PathMatchingResourcePatternResolver
org.springframework.web.context.support.ServletContextResourcePatternResolver
- All Implemented Interfaces:
- ResourceLoader,- ResourcePatternResolver
ServletContext-aware subclass of 
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.- Since:
- 1.1.2
- Author:
- Juergen Hoeller
- 
Field SummaryFields inherited from interface org.springframework.core.io.ResourceLoaderCLASSPATH_URL_PREFIXFields inherited from interface org.springframework.core.io.support.ResourcePatternResolverCLASSPATH_ALL_URL_PREFIX
- 
Constructor SummaryConstructorsConstructorDescriptionServletContextResourcePatternResolver(ServletContext servletContext) Create a new ServletContextResourcePatternResolver.ServletContextResourcePatternResolver(ResourceLoader resourceLoader) Create a new ServletContextResourcePatternResolver.
- 
Method SummaryModifier and TypeMethodDescriptiondoFindPathMatchingFileResources(Resource rootDirResource, String subPattern) Overridden version which checks for ServletContextResource and usesServletContext.getResourcePathsto find matching resources below the web application root directory.protected voiddoRetrieveMatchingServletContextResources(ServletContext servletContext, String fullPattern, String dir, Set<Resource> result) Recursively retrieve ServletContextResources that match the given pattern, adding them to the given result set.Methods inherited from class org.springframework.core.io.support.PathMatchingResourcePatternResolveraddAllClassLoaderJarRoots, addClassPathManifestEntries, convertClassLoaderURL, determineRootDir, doFindAllClassPathResources, doFindPathMatchingJarResources, findAllClassPathResources, findAllModulePathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, resolveRootDirResource, setPathMatcher
- 
Constructor Details- 
ServletContextResourcePatternResolverCreate a new ServletContextResourcePatternResolver.- Parameters:
- servletContext- the ServletContext to load resources with
- See Also:
 
- 
ServletContextResourcePatternResolverCreate a new ServletContextResourcePatternResolver.- Parameters:
- resourceLoader- the ResourceLoader to load root directories and actual resources with
 
 
- 
- 
Method Details- 
doFindPathMatchingFileResourcesprotected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException Overridden version which checks for ServletContextResource and usesServletContext.getResourcePathsto find matching resources below the web application root directory. In case of other resources, delegates to the superclass version.- Overrides:
- doFindPathMatchingFileResourcesin class- PathMatchingResourcePatternResolver
- Parameters:
- rootDirResource- the root directory as a Resource
- subPattern- the sub pattern to match (below the root directory)
- Returns:
- a mutable Set of matching Resource instances
- Throws:
- IOException- in case of I/O errors
- See Also:
 
- 
doRetrieveMatchingServletContextResourcesprotected void doRetrieveMatchingServletContextResources(ServletContext servletContext, String fullPattern, String dir, Set<Resource> result) throws IOException Recursively retrieve ServletContextResources that match the given pattern, adding them to the given result set.- Parameters:
- servletContext- the ServletContext to work on
- fullPattern- the pattern to match against, with prepended root directory path
- dir- the current directory
- result- the Set of matching Resources to add to
- Throws:
- IOException- if directory contents could not be retrieved
- See Also:
 
 
-