当前页面:
在线文档首页 >
Spring Framework 2.0.5 API 文档英文版
ServletContextResourcePatternResolver (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版
org.springframework.web.context.support
Class ServletContextResourcePatternResolver
java.lang.Object
org.springframework.core.io.support.PathMatchingResourcePatternResolver
org.springframework.web.context.support.ServletContextResourcePatternResolver
- All Implemented Interfaces:
- ResourceLoader, ResourcePatternResolver
public class ServletContextResourcePatternResolver
- extends PathMatchingResourcePatternResolver
ServletContext-aware subclass of PathMatchingResourcePatternResolver,
able to find matching resources below the web application root directory
via Servlet 2.3's ServletContext.getResourcePaths
.
Falls back to the superclass' file system checking for other resources.
The advantage of using ServletContext.getResourcePaths
to
find matching files is that it will work in a WAR file which has not been
expanded too. For Servlet containers that do not support Servlet 2.3 or
above, this resolver will always fall back to file system checking,
which requires an expanded WAR file.
- Since:
- 1.1.2
- Author:
- Juergen Hoeller
Methods inherited from class org.springframework.core.io.support.PathMatchingResourcePatternResolver |
convertClassLoaderURL, determineRootDir, doFindMatchingFileSystemResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, retrieveMatchingFiles, setPathMatcher |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServletContextResourcePatternResolver
public ServletContextResourcePatternResolver(ServletContext servletContext)
- Create a new ServletContextResourcePatternResolver.
- Parameters:
servletContext
- the ServletContext to load resources with- See Also:
ServletContextResourceLoader.ServletContextResourceLoader(javax.servlet.ServletContext)
ServletContextResourcePatternResolver
public ServletContextResourcePatternResolver(ResourceLoader resourceLoader)
- Create a new ServletContextResourcePatternResolver.
- Parameters:
resourceLoader
- the ResourceLoader to load root directories and
actual resources with
doFindPathMatchingFileResources
protected Set doFindPathMatchingFileResources(Resource rootDirResource,
String subPattern)
throws IOException
- Overridden version which checks for ServletContextResource
and uses
ServletContext.getResourcePaths
to find
matching resources below the web application root directory.
In case of other resources, delegates to the superclass version.
- Overrides:
doFindPathMatchingFileResources
in class PathMatchingResourcePatternResolver
- Parameters:
rootDirResource
- the root directory as ResourcesubPattern
- the sub pattern to match (below the root directory)
- Returns:
- the Set of matching Resource instances
- Throws:
IOException
- in case of I/O errors- See Also:
doRetrieveMatchingServletContextResources(javax.servlet.ServletContext, java.lang.String, java.lang.String, java.util.Set)
,
ServletContextResource
,
ServletContext.getResourcePaths(java.lang.String)
doRetrieveMatchingServletContextResources
protected void doRetrieveMatchingServletContextResources(ServletContext servletContext,
String fullPattern,
String dir,
Set result)
throws IOException
- Recursively retrieve ServletContextResources that match the given pattern,
adding them to the given result set.
- Parameters:
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 to
- Throws:
IOException
- if directory contents could not be retrieved- See Also:
ServletContextResource
,
ServletContext.getResourcePaths(java.lang.String)
Copyright © 2002-2007 The Spring Framework.