Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.context.support
Class ServletContextResourcePatternResolver

    java.lang.Object
      org.springframework.core.io.support.PathMatchingResourcePatternResolver
          org.springframework.web.context.support.ServletContextResourcePatternResolver

All Implemented Interfaces:
  ResourceLoader, ResourcePatternResolver

    public class ServletContextResourcePatternResolver

extends PathMatchingResourcePatternResolver

ServletContext-aware subclass of `PathMatchingResourcePatternResolver`, able to find matching resources below the web application root directory via Servlet 2.3's `ServletContext.getResourcePaths`. Falls back to the superclass' file system checking for other resources.

Since:
  1.1.2
Author:
  Juergen Hoeller

Field Summary

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`

Constructor Summary
`ServletContextResourcePatternResolver(ResourceLoader resourceLoader)` Create a new ServletContextResourcePatternResolver.
`ServletContextResourcePatternResolver(ServletContext servletContext)` Create a new ServletContextResourcePatternResolver.

Method Summary
`protected Set` | `doFindPathMatchingFileResources(Resource rootDirResource, String subPattern)` Overridden version which checks for ServletContextResource and uses `ServletContext.getResourcePaths` to find matching resources below the web application root directory.
`protected void` | `doRetrieveMatchingServletContextResources(ServletContext servletContext, String fullPattern, String dir, Set result)` Recursively retrieve ServletContextResources 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`

Constructor Detail

### ServletContextResourcePatternResolver

    public ServletContextResourcePatternResolver(ServletContext servletContext)

  Create a new ServletContextResourcePatternResolver.

  Parameters:
    `servletContext` - the ServletContext to load resources with
  See Also:
    `ServletContextResourceLoader.ServletContextResourceLoader(javax.servlet.ServletContext)`

### ServletContextResourcePatternResolver

    public ServletContextResourcePatternResolver(ResourceLoader resourceLoader)

  Create a new ServletContextResourcePatternResolver.

  Parameters:
    `resourceLoader` - the ResourceLoader to load root directories and actual resources with

Method Detail

### doFindPathMatchingFileResources

    protected Set doFindPathMatchingFileResources(Resource rootDirResource,
                                                  String subPattern)
                                           throws IOException

  Overridden version which checks for ServletContextResource and uses `ServletContext.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 Resource
    `subPattern` - 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:
    `doRetrieveMatchingServletContextResources(javax.servlet.ServletContext, java.lang.String, java.lang.String, java.util.Set)`, `ServletContextResource`, `ServletContext.getResourcePaths(java.lang.String)`

### doRetrieveMatchingServletContextResources

    protected void doRetrieveMatchingServletContextResources(ServletContext servletContext,
                                                             String fullPattern,
                                                             String dir,
                                                             Set result)
                                                      throws IOException

  Recursively retrieve ServletContextResources that match the given pattern, adding them to the given result set.

  Parameters:
    `servletContext` - the ServletContext 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:
    `ServletContextResource`, `ServletContext.getResourcePaths(java.lang.String)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.