public class GenericResourceRepository extends Object implements ResourceRepository, org.springframework.context.ResourceLoaderAware
ResourceRepository
backed by a SearchPathLocator
.Constructor and Description |
---|
GenericResourceRepository(SearchPathLocator service) |
Modifier and Type | Method and Description |
---|---|
org.springframework.core.io.Resource |
findOne(String application,
String profile,
String label,
String path) |
protected boolean |
isInvalidPath(String path)
Identifies invalid resource paths.
|
protected String |
processPath(String path)
Process the given resource path.
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
public GenericResourceRepository(SearchPathLocator service)
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public org.springframework.core.io.Resource findOne(String application, String profile, String label, String path)
findOne
in interface ResourceRepository
protected String processPath(String path)
The default implementation replaces:
" / // foo/bar"
becomes "/foo/bar"
.
protected boolean isInvalidPath(String path)
StringUtils.cleanPath(java.lang.String)
.
valid URL
or would represent one after the leading slash is removed.
Note: this method assumes that leading, duplicate '/' or control characters (e.g. white space) have been trimmed so that the path starts predictably with a single '/' or does not have one.
path
- the path to validatetrue
if the path is invalid, false
otherwiseCopyright © 2019 Pivotal Software, Inc.. All rights reserved.