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:
- org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver
public class PortletContextResourcePatternResolver
- extends org.springframework.core.io.support.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
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
CLASSPATH_ALL_URL_PREFIX |
Fields inherited from interface org.springframework.core.io.ResourceLoader |
CLASSPATH_URL_PREFIX |
Method Summary |
protected java.util.Set<org.springframework.core.io.Resource> |
doFindPathMatchingFileResources(org.springframework.core.io.Resource rootDirResource,
java.lang.String subPattern)
Overridden version which checks for PortletContextResource
and uses PortletContext.getResourcePaths to find
matching resources below the web application root directory. |
protected void |
doRetrieveMatchingPortletContextResources(javax.portlet.PortletContext portletContext,
java.lang.String fullPattern,
java.lang.String dir,
java.util.Set<org.springframework.core.io.Resource> result)
Recursively retrieve PortletContextResources that match the given pattern,
adding them to the given result set. |
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(javax.portlet.PortletContext portletContext)
- Create a new PortletContextResourcePatternResolver.
- Parameters:
portletContext
- the PortletContext to load resources with- See Also:
PortletContextResourceLoader.PortletContextResourceLoader(javax.portlet.PortletContext)
PortletContextResourcePatternResolver
public PortletContextResourcePatternResolver(org.springframework.core.io.ResourceLoader resourceLoader)
- Create a new PortletContextResourcePatternResolver.
- Parameters:
resourceLoader
- the ResourceLoader to load root directories and
actual resources with
doFindPathMatchingFileResources
protected java.util.Set<org.springframework.core.io.Resource> doFindPathMatchingFileResources(org.springframework.core.io.Resource rootDirResource,
java.lang.String subPattern)
throws java.io.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 org.springframework.core.io.support.PathMatchingResourcePatternResolver
- Throws:
java.io.IOException
- 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(javax.portlet.PortletContext portletContext,
java.lang.String fullPattern,
java.lang.String dir,
java.util.Set<org.springframework.core.io.Resource> result)
throws java.io.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:
java.io.IOException
- if directory contents could not be retrieved- See Also:
PortletContextResource
,
PortletContext.getResourcePaths(java.lang.String)