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(javax.portlet.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(javax.portlet.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, addClassPathManifestEntries, convertClassLoaderURL, determineRootDir, doFindAllClassPathResources, doFindMatchingFileSystemResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, getResources, isJarResource, listDirectory, resolveRootDirResource, retrieveMatchingFiles, setPathMatcher
public PortletContextResourcePatternResolver(javax.portlet.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
IOException
doRetrieveMatchingPortletContextResources(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(javax.portlet.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)
Copyright © 2019 Liferay, Inc.. All rights reserved.