public class

PortletContextResourcePatternResolver

extends PathMatchingResourcePatternResolver
java.lang.Object
   ↳ org.springframework.core.io.support.PathMatchingResourcePatternResolver
     ↳ org.springframework.web.portlet.context.PortletContextResourcePatternResolver

Class Overview

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.

Summary

[Expand]
Inherited Constants
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver
Public Constructors
PortletContextResourcePatternResolver(PortletContext portletContext)
Create a new PortletContextResourcePatternResolver.
Protected Methods
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.
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.
[Expand]
Inherited Methods
From class org.springframework.core.io.support.PathMatchingResourcePatternResolver
From class java.lang.Object
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver

Public Constructors

public PortletContextResourcePatternResolver (PortletContext portletContext)

Create a new PortletContextResourcePatternResolver.

Parameters
portletContext the PortletContext to load resources with
See Also
  • PortletContextResourceLoader#PortletContextResourceLoader(javax.portlet.PortletContext)

Protected Methods

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. In case of other resources, delegates to the superclass version.

Parameters
rootDirResource the root directory as Resource
subPattern the sub pattern to match (below the root directory)
Returns
  • the Set of matching Resource instances
Throws
IOException

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.

Parameters
portletContext the PortletContext to work on
fullPattern the pattern to match against, with preprended root directory path
dir the current directory
result the Set of matching Resources to add to
Throws
IOException if directory contents could not be retrieved
See Also