public class PathMatchingSimpleStorageResourcePatternResolver extends Object implements org.springframework.core.io.support.ResourcePatternResolver
ResourcePatternResolver
implementation which allows an ant-style path matching when
loading S3 resources. Ant wildcards (*, ** and ?) are allowed in both, bucket name and object
name.
WARNING:
Be aware that when you are using wildcards in the bucket name it can take a very long time to parse all
files. Moreover this implementation does not return truncated results. This means that when handling
huge buckets it could lead to serious performance problems. For more information look at the
findProgressivelyWithPartialMatch
method.
Constructor and Description |
---|
PathMatchingSimpleStorageResourcePatternResolver(com.amazonaws.services.s3.AmazonS3 amazonS3,
org.springframework.core.io.ResourceLoader simpleStorageResourceLoader,
org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolverDelegate)
Construct a new instance of the
PathMatchingSimpleStorageResourcePatternResolver with a
SimpleStorageResourceLoader to load AmazonS3 instances, and also a delegate ResourcePatternResolver
to resolve resource on default path (like file and classpath) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.core.io.Resource[] |
findPathMatchingResources(String locationPattern) |
ClassLoader |
getClassLoader() |
org.springframework.core.io.Resource |
getResource(String location) |
org.springframework.core.io.Resource[] |
getResources(String locationPattern) |
void |
setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
Set the PathMatcher implementation to use for this
resource pattern resolver.
|
public PathMatchingSimpleStorageResourcePatternResolver(com.amazonaws.services.s3.AmazonS3 amazonS3, org.springframework.core.io.ResourceLoader simpleStorageResourceLoader, org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolverDelegate)
PathMatchingSimpleStorageResourcePatternResolver
with a
SimpleStorageResourceLoader
to load AmazonS3 instances, and also a delegate ResourcePatternResolver
to resolve resource on default path (like file and classpath)amazonS3
- - used to retrieve the directory listingssimpleStorageResourceLoader
- - used to retrieve object from amazon s3resourcePatternResolverDelegate
- - delegate resolver used to resolve common path (file, classpath, servlet etc.)public void setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
pathMatcher
- The pathMatches implementation used, must not be nullAntPathMatcher
public org.springframework.core.io.Resource[] getResources(String locationPattern) throws IOException
getResources
in interface org.springframework.core.io.support.ResourcePatternResolver
IOException
protected org.springframework.core.io.Resource[] findPathMatchingResources(String locationPattern)
public org.springframework.core.io.Resource getResource(String location)
getResource
in interface org.springframework.core.io.ResourceLoader
public ClassLoader getClassLoader()
getClassLoader
in interface org.springframework.core.io.ResourceLoader
Copyright © 2016 Pivotal Software, Inc.. All rights reserved.