org.springframework.web.portlet.context
Class PortletContextResourcePatternResolver
java.lang.Object
org.springframework.core.io.support.PathMatchingResourcePatternResolver
org.springframework.web.portlet.context.PortletContextResourcePatternResolver
- All Implemented Interfaces:
- ResourceLoader, ResourcePatternResolver
public class PortletContextResourcePatternResolver
- extends PathMatchingResourcePatternResolver
PortletContext-aware subclass of PathMatchingResourcePatternResolver
,
able to find matching resources below the web application root directory
via Portlet API's PortletContext.getResourcePaths
.
Falls back to the superclass' file system checking for other resources.
The advantage of using PortletContext.getResourcePaths
to
find matching files is that it will work in a WAR file which has not been
expanded too.
- Since:
- 2.0
- Author:
- Juergen Hoeller, John A. Lewis
Methods inherited from class org.springframework.core.io.support.PathMatchingResourcePatternResolver |
convertClassLoaderURL, determineRootDir, doFindMatchingFileSystemResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, resolveRootDirResource, retrieveMatchingFiles, setPathMatcher |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PortletContextResourcePatternResolver
public PortletContextResourcePatternResolver(PortletContext portletContext)
- Create a new PortletContextResourcePatternResolver.
- Parameters:
portletContext
- the PortletContext to load resources with- See Also:
PortletContextResourceLoader.PortletContextResourceLoader(javax.portlet.PortletContext)
PortletContextResourcePatternResolver
public PortletContextResourcePatternResolver(ResourceLoader resourceLoader)
- Create a new PortletContextResourcePatternResolver.
- Parameters:
resourceLoader
- the ResourceLoader to load root directories and
actual resources with
doFindPathMatchingFileResources
protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource,
String subPattern)
throws IOException
- Overridden version which checks for PortletContextResource
and uses
PortletContext.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:
doRetrieveMatchingPortletContextResources(javax.portlet.PortletContext, java.lang.String, java.lang.String, java.util.Set)
,
PortletContextResource
,
PortletContext.getResourcePaths(java.lang.String)
doRetrieveMatchingPortletContextResources
protected void doRetrieveMatchingPortletContextResources(PortletContext portletContext,
String fullPattern,
String dir,
Set<Resource> result)
throws IOException
- Recursively retrieve PortletContextResources that match the given pattern,
adding them to the given result set.
- Parameters:
portletContext
- the PortletContext 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:
PortletContextResource
,
PortletContext.getResourcePaths(java.lang.String)