Top Description Inners Fields Constructors Methods
org.springframework.core.io.support

public Class PathMatchingResourcePatternResolver

extends Object
implements ResourcePatternResolver
Class Inheritance
All Implemented Interfaces
org.springframework.core.io.support.ResourcePatternResolver, org.springframework.core.io.ResourceLoader
Imports
java.io.File, .FileNotFoundException, .IOException, .UncheckedIOException, java.lang.module.ModuleFinder, .ModuleReader, .ResolvedModule, java.lang.reflect.InvocationHandler, .Method, java.net.JarURLConnection, .MalformedURLException, .URI, .URISyntaxException, .URL, .URLClassLoader, .URLConnection, java.nio.file.FileSystemNotFoundException, .FileSystems, .Files, .Path, java.util.Collections, .Enumeration, .LinkedHashSet, .Map, .Objects, .Set, java.util.function.Predicate, java.util.jar.JarEntry, .JarFile, java.util.stream.Collectors, .Stream, java.util.zip.ZipException, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.NativeDetector, org.springframework.core.io.DefaultResourceLoader, .FileSystemResource, .Resource, .ResourceLoader, .UrlResource, .VfsResource, org.springframework.lang.Nullable, org.springframework.util.AntPathMatcher, .Assert, .ClassUtils, .PathMatcher, .ReflectionUtils, .ResourceUtils, .StringUtils

A ResourcePatternResolver implementation that is able to resolve a specified resource location path into one or more matching Resources.

The source path may be a simple path which has a one-to-one mapping to a target org.springframework.core.io.Resource, or alternatively may contain the special "classpath*:" prefix and/or internal Ant-style path patterns (matched using Spring's AntPathMatcher utility). Both of the latter are effectively wildcards.

No Wildcards

In the simple case, if the specified location path does not start with the "classpath*:" prefix and does not contain a PathMatcher pattern, this resolver will simply return a single resource via a getResource() call on the underlying ResourceLoader. Examples are real URLs such as "file:C:/context.xml", pseudo-URLs such as "classpath:/context.xml", and simple unprefixed paths such as "/WEB-INF/context.xml". The latter will resolve in a fashion specific to the underlying ResourceLoader (e.g. ServletContextResource for a WebApplicationContext).

Ant-style Patterns

When the path location contains an Ant-style pattern, for example:

/WEB-INF/*-context.xml
com/example/**/applicationContext.xml
file:C:/some/path/*-context.xml
classpath:com/example/**/applicationContext.xml
the resolver follows a more complex but defined procedure to try to resolve the wildcard. It produces a Resource for the path up to the last non-wildcard segment and obtains a URL from it. If this URL is not a "jar:" URL or container-specific variant (e.g. "zip:" in WebLogic, "wsjar" in WebSphere", etc.), then the root directory of the filesystem associated with the URL is obtained and used to resolve the wildcards by walking the filesystem. In the case of a jar URL, the resolver either gets a java.net.JarURLConnection from it, or manually parses the jar URL, and then traverses the contents of the jar file, to resolve the wildcards.

Implications on Portability

If the specified path is already a file URL (either explicitly, or implicitly because the base ResourceLoader is a filesystem one), then wildcarding is guaranteed to work in a completely portable fashion.

If the specified path is a class path location, then the resolver must obtain the last non-wildcard path segment URL via a Classloader.getResource() call. Since this is just a node of the path (not the file at the end) it is actually undefined (in the ClassLoader Javadocs) exactly what sort of URL is returned in this case. In practice, it is usually a java.io.File representing the directory, where the class path resource resolves to a filesystem location, or a jar URL of some sort, where the class path resource resolves to a jar location. Still, there is a portability concern on this operation.

If a jar URL is obtained for the last non-wildcard segment, the resolver must be able to get a java.net.JarURLConnection from it, or manually parse the jar URL, to be able to walk the contents of the jar and resolve the wildcard. This will work in most environments but will fail in others, and it is strongly recommended that the wildcard resolution of resources coming from jars be thoroughly tested in your specific environment before you rely on it.

classpath*: Prefix

There is special support for retrieving multiple class path resources with the same name, via the "classpath*:" prefix. For example, "classpath*:META-INF/beans.xml" will find all "META-INF/beans.xml" files in the class path, be it in "classes" directories or in JAR files. This is particularly useful for autodetecting config files of the same name at the same location within each jar file. Internally, this happens via a ClassLoader.getResources() call, and is completely portable.

The "classpath*:" prefix can also be combined with a PathMatcher pattern in the rest of the location path — for example, "classpath*:META-INF/*-beans.xml". In this case, the resolution strategy is fairly simple: a ClassLoader.getResources() call is used on the last non-wildcard path segment to get all the matching resources in the class loader hierarchy, and then off each resource the same PathMatcher resolution strategy described above is used for the wildcard sub pattern.

Other Notes

As of Spring Framework 6.0, if getResources(String) is invoked with a location pattern using the "classpath*:" prefix it will first search all modules in the boot layer, excluding system modules. It will then search the class path using ClassLoader APIs as described previously and return the combined results. Consequently, some of the limitations of class path searches may not apply when applications are deployed as modules.

Warning

Note that "classpath*:" when combined with Ant-style patterns will only work reliably with at least one root directory before the pattern starts, unless the actual target files reside in the file system. This means that a pattern like "classpath*:*.xml" will not retrieve files from the root of jar files but rather only from the root of expanded directories. This originates from a limitation in the JDK's ClassLoader.getResources() method which only returns file system locations for a passed-in empty String (indicating potential roots to search). This ResourcePatternResolver implementation tries to mitigate the jar root lookup limitation through URLClassLoader introspection and "java.class.path" manifest evaluation; however, without portability guarantees.

Warning

Ant-style patterns with "classpath:" resources are not guaranteed to find matching resources if the base package to search is available in multiple class path locations. This is because a resource such as

  com/example/package1/service-context.xml
may exist in only one class path location, but when a location pattern such as
  classpath:com/example/**/service-context.xml
is used to try to resolve it, the resolver will work off the (first) URL returned by getResource("com/example"). If the com/example base package node exists in multiple class path locations, the actual desired resource may not be present under the com/example base package in the first URL. Therefore, preferably, use "classpath*:" with the same Ant-style pattern in such a case, which will search all class path locations that contain the base package.
Authors
Juergen Hoeller, Colin Sampaleanu, Marius Bogoevici, Costin Leau, Phillip Webb, Sam Brannen, Sebastien Deleuze, Dave Syer
Since
1.0.2
See Also
CLASSPATH_ALL_URL_PREFIX, org.springframework.util.AntPathMatcher, org.springframework.core.io.ResourceLoader#getResource(String), ClassLoader#getResources(String)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
PathMatchingResourcePatternResolver.VfsResourceMatchingDelegate

Inner delegate class, avoiding a hard JBoss VFS API dependency at runtime.

Field Summary

Modifier and TypeField and Description
private static Method
private static final Predicate<ResolvedModule>
isNotSystemModule

Predicate that tests whether the supplied ResolvedModule is not a system module.

private static final Log
private PathMatcher
private final ResourceLoader
private static final Set<String>

Constructor Summary

AccessConstructor and Description
public
PathMatchingResourcePatternResolver()

Create a PathMatchingResourcePatternResolver with a DefaultResourceLoader.

public
PathMatchingResourcePatternResolver(ResourceLoader
the ResourceLoader to load root directories and actual resources with
resourceLoader
)

Create a PathMatchingResourcePatternResolver with the supplied ResourceLoader.

public
PathMatchingResourcePatternResolver(ClassLoader
the ClassLoader to load class path resources with, or null for using the thread context class loader at the time of actual resource access
classLoader
)

Create a PathMatchingResourcePatternResolver with a DefaultResourceLoader and the supplied ClassLoader.

Method Summary

Modifier and TypeMethod and Description
protected void
addAllClassLoaderJarRoots(ClassLoader
the ClassLoader to search (including its ancestors)
classLoader
,
Set<Resource>
the set of resources to add jar roots to
result
)

Search all URLClassLoader URLs for jar file references and add each to the given set of resources in the form of a pointer to the root of the jar file content.

protected void
addClassPathManifestEntries(Set<Resource>
the set of resources to add jar roots to
result
)

Determine jar file references from Class-Path manifest entries (which are added to the java.class.path JVM system property by the system class loader) and add each to the given set of resources in the form of a pointer to the root of the jar file content.

protected Resource

Returns:

the corresponding Resource object
convertClassLoaderURL
(URL
a URL as returned from the configured ClassLoader
url
)

Convert the given URL as returned from the configured ClassLoader into a Resource, applying to path lookups without a pattern (see findAllClassPathResources).

private Resource
convertModuleSystemURI(URI uri)

If it's a "file:" URI, use FileSystemResource to avoid duplicates for the same path discovered via class path scanning.

protected String

Returns:

the part of the location that denotes the root directory
determineRootDir
(String
the location to check
location
)

Determine the root directory for the given location.

protected Set<Resource>

Returns:

a mutable Set of matching Resource instances
doFindAllClassPathResources
(String
the absolute path within the class path (never a leading slash)
path
)

Find all class path resources with the given path via the configured ClassLoader.

protected Set<Resource>

Returns:

a mutable Set of matching Resource instances
doFindPathMatchingFileResources
(Resource
the root directory as a Resource
rootDirResource
,
String
the sub pattern to match (below the root directory)
subPattern
)

Find all resources in the file system of the supplied root directory that match the given location sub pattern via the Ant-style PathMatcher.

protected Set<Resource>

Returns:

a mutable Set of matching Resource instances
doFindPathMatchingJarResources
(Resource
the root directory as Resource
rootDirResource
,
URL
the pre-resolved root directory URL
rootDirUrl
,
String
the sub pattern to match (below the root directory)
subPattern
)

Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher.

protected Resource[]

Returns:

the result as Resource array
findAllClassPathResources
(String
the absolute path within the class path
location
)

Find all class location resources with the given location via the ClassLoader.

protected Set<Resource>

Returns:

a modifiable Set containing the corresponding Resource objects
findAllModulePathResources
(String
the location pattern to resolve
locationPattern
)

Resolve the given location pattern into Resource objects for all matching resources found in the module path.

protected Resource[]

Returns:

the result as Resource array
findPathMatchingResources
(String
the location pattern to match
locationPattern
)

Find all resources that match the given location pattern via the Ant-style PathMatcher.

private Resource
findResource(ModuleReader moduleReader, String name)

public ClassLoader
getClassLoader()

Implements org.springframework.core.io.ResourceLoader.getClassLoader.

Expose the ClassLoader used by this ResourceLoader.
protected JarFile
getJarFile(String jarFileUrl)

Resolve the given jar file URL into a JarFile object.

public PathMatcher
getPathMatcher()

Return the PathMatcher that this resource pattern resolver uses.

public Resource
getResource(String
the resource location
location
)

Implements org.springframework.core.io.ResourceLoader.getResource.

Return a Resource handle for the specified resource location.
public ResourceLoader
getResourceLoader()

Return the ResourceLoader that this pattern resolver works with.

public Resource[]
getResources(String
the location pattern to resolve
locationPattern
)

Implements org.springframework.core.io.support.ResourcePatternResolver.getResources.

Resolve the given location pattern into Resource objects.
private boolean

Returns:

true if there is a duplicate (i.e. to ignore the given file path), false to proceed with adding a corresponding resource to the current result
hasDuplicate
(String
the file path (with or without a leading slash)
filePath
,
Set<Resource>
the current result
result
)

Check whether the given file path has a duplicate but differently structured entry in the existing result, i.e. with or without a leading slash.

protected boolean

Returns:

true if the given resource handle indicates a jar resource
isJarResource
(Resource
the resource handle to check (usually the root directory to start path matching from)
resource
)

Determine if the given resource handle indicates a jar resource that the doFindPathMatchingJarResources method can handle.

protected Resource

Returns:

the resolved resource (may be identical to the supplied resource)
resolveRootDirResource
(Resource
the resource to resolve
original
)

Resolve the supplied root directory resource for path matching.

public void
setPathMatcher(PathMatcher pathMatcher)

Set the PathMatcher implementation to use for this resource pattern resolver.

private static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

equinoxResolveMethodback to summary
private static Method equinoxResolveMethod
Annotations
@Nullable
isNotSystemModuleback to summary
private static final Predicate<ResolvedModule> isNotSystemModule

Predicate that tests whether the supplied ResolvedModule is not a system module.

Since
6.0
See Also
systemModuleNames
loggerback to summary
private static final Log logger
pathMatcherback to summary
private PathMatcher pathMatcher
resourceLoaderback to summary
private final ResourceLoader resourceLoader
systemModuleNamesback to summary
private static final Set<String> systemModuleNames

Set of system module names.

Since
6.0
See Also
isNotSystemModule

Constructor Detail

PathMatchingResourcePatternResolverback to summary
public PathMatchingResourcePatternResolver()

Create a PathMatchingResourcePatternResolver with a DefaultResourceLoader.

ClassLoader access will happen via the thread context class loader.

See Also
DefaultResourceLoader
PathMatchingResourcePatternResolverback to summary
public PathMatchingResourcePatternResolver(ResourceLoader resourceLoader)

Create a PathMatchingResourcePatternResolver with the supplied ResourceLoader.

ClassLoader access will happen via the thread context class loader.

Parameters
resourceLoader:ResourceLoader

the ResourceLoader to load root directories and actual resources with

PathMatchingResourcePatternResolverback to summary
public PathMatchingResourcePatternResolver(ClassLoader classLoader)

Create a PathMatchingResourcePatternResolver with a DefaultResourceLoader and the supplied ClassLoader.

Parameters
classLoader:ClassLoader

the ClassLoader to load class path resources with, or null for using the thread context class loader at the time of actual resource access

See Also
org.springframework.core.io.DefaultResourceLoader

Method Detail

addAllClassLoaderJarRootsback to summary
protected void addAllClassLoaderJarRoots(ClassLoader classLoader, Set<Resource> result)

Search all URLClassLoader URLs for jar file references and add each to the given set of resources in the form of a pointer to the root of the jar file content.

Parameters
classLoader:ClassLoader

the ClassLoader to search (including its ancestors)

result:Set<Resource>

the set of resources to add jar roots to

Since
4.1.1
addClassPathManifestEntriesback to summary
protected void addClassPathManifestEntries(Set<Resource> result)

Determine jar file references from Class-Path manifest entries (which are added to the java.class.path JVM system property by the system class loader) and add each to the given set of resources in the form of a pointer to the root of the jar file content.

Parameters
result:Set<Resource>

the set of resources to add jar roots to

Since
4.3
convertClassLoaderURLback to summary
protected Resource convertClassLoaderURL(URL url)

Convert the given URL as returned from the configured ClassLoader into a Resource, applying to path lookups without a pattern (see findAllClassPathResources).

As of 6.0.5, the default implementation creates a FileSystemResource in case of the "file" protocol or a UrlResource otherwise, matching the outcome of pattern-based class path traversal in the same resource layout, as well as matching the outcome of module path searches.

Parameters
url:URL

a URL as returned from the configured ClassLoader

Returns:Resource

the corresponding Resource object

See Also
java.lang.ClassLoader#getResources, doFindAllClassPathResources, doFindPathMatchingFileResources
convertModuleSystemURIback to summary
private Resource convertModuleSystemURI(URI uri)

If it's a "file:" URI, use FileSystemResource to avoid duplicates for the same path discovered via class path scanning.

determineRootDirback to summary
protected String determineRootDir(String location)

Determine the root directory for the given location.

Used for determining the starting point for file matching, resolving the root directory location to be passed into getResources(String), with the remainder of the location to be used as the sub pattern.

Will return "/WEB-INF/" for the location "/WEB-INF/*.xml", for example.

Parameters
location:String

the location to check

Returns:String

the part of the location that denotes the root directory

See Also
findPathMatchingResources(String)
doFindAllClassPathResourcesback to summary
protected Set<Resource> doFindAllClassPathResources(String path) throws IOException

Find all class path resources with the given path via the configured ClassLoader.

Called by findAllClassPathResources(String).

Parameters
path:String

the absolute path within the class path (never a leading slash)

Returns:Set<Resource>

a mutable Set of matching Resource instances

Since
4.1.1
doFindPathMatchingFileResourcesback to summary
protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException

Find all resources in the file system of the supplied root directory that match the given location sub pattern via the Ant-style PathMatcher.

Parameters
rootDirResource:Resource

the root directory as a Resource

subPattern:String

the sub pattern to match (below the root directory)

Returns:Set<Resource>

a mutable Set of matching Resource instances

Exceptions
IOException:
in case of I/O errors
See Also
org.springframework.util.PathMatcher
doFindPathMatchingJarResourcesback to summary
protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource, URL rootDirUrl, String subPattern) throws IOException

Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher.

Parameters
rootDirResource:Resource

the root directory as Resource

rootDirUrl:URL

the pre-resolved root directory URL

subPattern:String

the sub pattern to match (below the root directory)

Returns:Set<Resource>

a mutable Set of matching Resource instances

Exceptions
IOException:
in case of I/O errors
Since
4.3
See Also
java.net.JarURLConnection, org.springframework.util.PathMatcher
findAllClassPathResourcesback to summary
protected Resource[] findAllClassPathResources(String location) throws IOException

Find all class location resources with the given location via the ClassLoader.

Delegates to doFindAllClassPathResources(String).

Parameters
location:String

the absolute path within the class path

Returns:Resource[]

the result as Resource array

Exceptions
IOException:
in case of I/O errors
See Also
java.lang.ClassLoader#getResources, convertClassLoaderURL
findAllModulePathResourcesback to summary
protected Set<Resource> findAllModulePathResources(String locationPattern) throws IOException

Resolve the given location pattern into Resource objects for all matching resources found in the module path.

The location pattern may be an explicit resource path such as "com/example/config.xml" or a pattern such as "com/example/**/config-*.xml" to be matched using the configured PathMatcher.

The default implementation scans all modules in the boot layer, excluding system modules.

Parameters
locationPattern:String

the location pattern to resolve

Returns:Set<Resource>

a modifiable Set containing the corresponding Resource objects

Exceptions
IOException:
in case of I/O errors
Since
6.0
See Also
ModuleLayer#boot(), ModuleFinder#ofSystem(), ModuleReader, PathMatcher#match(String, String)
findPathMatchingResourcesback to summary
protected Resource[] findPathMatchingResources(String locationPattern) throws IOException

Find all resources that match the given location pattern via the Ant-style PathMatcher.

Supports resources in OSGi bundles, JBoss VFS, jar files, zip files, and file systems.

Parameters
locationPattern:String

the location pattern to match

Returns:Resource[]

the result as Resource array

Exceptions
IOException:
in case of I/O errors
See Also
determineRootDir(String), resolveRootDirResource(Resource), isJarResource(Resource), doFindPathMatchingJarResources(Resource, URL, String), doFindPathMatchingFileResources(Resource, String), org.springframework.util.PathMatcher
findResourceback to summary
private Resource findResource(ModuleReader moduleReader, String name)
Annotations
@Nullable
getClassLoaderback to summary
public ClassLoader getClassLoader()

Implements org.springframework.core.io.ResourceLoader.getClassLoader.

Doc from org.springframework.core.io.ResourceLoader.getClassLoader.

Expose the ClassLoader used by this ResourceLoader.

Clients which need to access the ClassLoader directly can do so in a uniform manner with the ResourceLoader, rather than relying on the thread context ClassLoader.

Returns:ClassLoader

the ClassLoader (only null if even the system ClassLoader isn't accessible)

Annotations
@Override
@Nullable
getJarFileback to summary
protected JarFile getJarFile(String jarFileUrl) throws IOException

Resolve the given jar file URL into a JarFile object.

getPathMatcherback to summary
public PathMatcher getPathMatcher()

Return the PathMatcher that this resource pattern resolver uses.

getResourceback to summary
public Resource getResource(String location)

Implements org.springframework.core.io.ResourceLoader.getResource.

Doc from org.springframework.core.io.ResourceLoader.getResource.

Return a Resource handle for the specified resource location.

The handle should always be a reusable resource descriptor, allowing for multiple Resource#getInputStream() calls.

  • Must support fully qualified URLs, e.g. "file:C:/test.dat".
  • Must support classpath pseudo-URLs, e.g. "classpath:test.dat".
  • Should support relative file paths, e.g. "WEB-INF/test.dat". (This will be implementation-specific, typically provided by an ApplicationContext implementation.)

Note that a Resource handle does not imply an existing resource; you need to invoke Resource#exists to check for existence.

Parameters
location:String

the resource location

Returns:Resource

a corresponding Resource handle (never null)

Annotations
@Override
getResourceLoaderback to summary
public ResourceLoader getResourceLoader()

Return the ResourceLoader that this pattern resolver works with.

getResourcesback to summary
public Resource[] getResources(String locationPattern) throws IOException

Implements org.springframework.core.io.support.ResourcePatternResolver.getResources.

Doc from org.springframework.core.io.support.ResourcePatternResolver.getResources.

Resolve the given location pattern into Resource objects.

Overlapping resource entries that point to the same physical resource should be avoided, as far as possible. The result should have set semantics.

Parameters
locationPattern:String

the location pattern to resolve

Returns:Resource[]

the corresponding Resource objects

Annotations
@Override
Exceptions
IOException:
in case of I/O errors
hasDuplicateback to summary
private boolean hasDuplicate(String filePath, Set<Resource> result)

Check whether the given file path has a duplicate but differently structured entry in the existing result, i.e. with or without a leading slash.

Parameters
filePath:String

the file path (with or without a leading slash)

result:Set<Resource>

the current result

Returns:boolean

true if there is a duplicate (i.e. to ignore the given file path), false to proceed with adding a corresponding resource to the current result

isJarResourceback to summary
protected boolean isJarResource(Resource resource) throws IOException

Determine if the given resource handle indicates a jar resource that the doFindPathMatchingJarResources method can handle.

findPathMatchingResources(String) delegates to ResourceUtils#isJarURL(URL) to determine whether the given URL points to a resource in a jar file, and only invokes this method as a fallback.

This template method therefore allows for detecting further kinds of jar-like resources — for example, via instanceof checks on the resource handle type.

The default implementation of this method returns false.

Parameters
resource:Resource

the resource handle to check (usually the root directory to start path matching from)

Returns:boolean

true if the given resource handle indicates a jar resource

Exceptions
IOException:
in case of I/O errors
See Also
findPathMatchingResources(String), doFindPathMatchingJarResources(Resource, URL, String), org.springframework.util.ResourceUtils#isJarURL
resolveRootDirResourceback to summary
protected Resource resolveRootDirResource(Resource original) throws IOException

Resolve the supplied root directory resource for path matching.

By default, findPathMatchingResources(String) resolves Equinox OSGi "bundleresource:" and "bundleentry:" URLs into standard jar file URLs that will be traversed using Spring's standard jar file traversal algorithm.

For any custom resolution, override this template method and replace the supplied resource handle accordingly.

The default implementation of this method returns the supplied resource unmodified.

Parameters
original:Resource

the resource to resolve

Returns:Resource

the resolved resource (may be identical to the supplied resource)

Exceptions
IOException:
in case of resolution failure
See Also
findPathMatchingResources(String)
setPathMatcherback to summary
public void setPathMatcher(PathMatcher pathMatcher)

Set the PathMatcher implementation to use for this resource pattern resolver.

Default is AntPathMatcher.

See Also
AntPathMatcher
stripLeadingSlashback to summary
private static String stripLeadingSlash(String path)
org.springframework.core.io.support back to summary

private Class PathMatchingResourcePatternResolver.PatternVirtualFileVisitor

extends Object
implements InvocationHandler
Class Inheritance
  • java.lang.Object
  • org.springframework.core.io.support.PathMatchingResourcePatternResolver.PatternVirtualFileVisitor
All Implemented Interfaces
java.lang.reflect.InvocationHandler
Annotations
@SuppressWarnings:unused

VFS visitor for path matching purposes.

Field Summary

Modifier and TypeField and Description
private final PathMatcher
private final Set<Resource>
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher pathMatcher)

Method Summary

Modifier and TypeMethod and Description
public Object
public Set<Resource>
public Object
invoke(Object
the proxy instance that the method was invoked on
proxy
,
Method
the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.
method
,
Object[]
an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.
args
)

Implements java.lang.reflect.InvocationHandler.invoke.

Processes a method invocation on a proxy instance and returns the result.
public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
visit(Object vfsResource)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

pathMatcherback to summary
private final PathMatcher pathMatcher
resourcesback to summary
private final Set<Resource> resources
rootPathback to summary
private final String rootPath
subPatternback to summary
private final String subPattern

Constructor Detail

PatternVirtualFileVisitorback to summary
public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher pathMatcher)

Method Detail

getAttributesback to summary
public Object getAttributes()
Annotations
@Nullable
getResourcesback to summary
public Set<Resource> getResources()
invokeback to summary
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable

Implements java.lang.reflect.InvocationHandler.invoke.

Doc from java.lang.reflect.InvocationHandler.invoke.

Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.

Parameters
proxy:Object

the proxy instance that the method was invoked on

method:Method

the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.

args:Object[]

an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.

Returns:Object

the value to return from the method invocation on the proxy instance. If the declared return type of the interface method is a primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper class; otherwise, it must be a type assignable to the declared return type. If the value returned by this method is null and the interface method's return type is primitive, then a NullPointerException will be thrown by the method invocation on the proxy instance. If the value returned by this method is otherwise not compatible with the interface method's declared return type as described above, a ClassCastException will be thrown by the method invocation on the proxy instance.

Annotations
@Override
@Nullable
Exceptions
Throwable:
the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the throws clause of the interface method or to the unchecked exception types java.lang.RuntimeException or java.lang.Error. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
visitback to summary
public void visit(Object vfsResource)
org.springframework.core.io.support back to summary

private Class PathMatchingResourcePatternResolver.VfsResourceMatchingDelegate

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.core.io.support.PathMatchingResourcePatternResolver.VfsResourceMatchingDelegate

Inner delegate class, avoiding a hard JBoss VFS API dependency at runtime.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Set<Resource>
findMatchingResources(URL rootDirUrl, String locationPattern, PathMatcher pathMatcher)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VfsResourceMatchingDelegateback to summary
private VfsResourceMatchingDelegate()

Method Detail

findMatchingResourcesback to summary
public static Set<Resource> findMatchingResources(URL rootDirUrl, String locationPattern, PathMatcher pathMatcher) throws IOException