public class PortletContextResourcePatternResolver extends PathMatchingResourcePatternResolver
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.
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
Constructor and Description |
---|
PortletContextResourcePatternResolver(PortletContext portletContext)
Create a new PortletContextResourcePatternResolver.
|
PortletContextResourcePatternResolver(ResourceLoader resourceLoader)
Create a new PortletContextResourcePatternResolver.
|
Modifier and Type | Method and Description |
---|---|
protected Set<Resource> |
doFindPathMatchingFileResources(Resource rootDirResource,
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(PortletContext portletContext,
String fullPattern,
String dir,
Set<Resource> result)
Recursively retrieve PortletContextResources that match the given pattern,
adding them to the given result set.
|
addAllClassLoaderJarRoots, convertClassLoaderURL, determineRootDir, doFindAllClassPathResources, doFindMatchingFileSystemResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, resolveRootDirResource, retrieveMatchingFiles, setPathMatcher
public PortletContextResourcePatternResolver(PortletContext portletContext)
portletContext
- the PortletContext to load resources withPortletContextResourceLoader.PortletContextResourceLoader(javax.portlet.PortletContext)
public PortletContextResourcePatternResolver(ResourceLoader resourceLoader)
resourceLoader
- the ResourceLoader to load root directories and
actual resources withprotected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException
PortletContext.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)IOException
- in case of I/O errorsdoRetrieveMatchingPortletContextResources(javax.portlet.PortletContext, java.lang.String, java.lang.String, java.util.Set<org.springframework.core.io.Resource>)
,
PortletContextResource
,
PortletContext.getResourcePaths(java.lang.String)
protected void doRetrieveMatchingPortletContextResources(PortletContext portletContext, String fullPattern, String dir, Set<Resource> result) throws IOException
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 toIOException
- if directory contents could not be retrievedPortletContextResource
,
PortletContext.getResourcePaths(java.lang.String)