Class ResourcePatternUtils
- java.lang.Object
- org.springframework.core.io.support.ResourcePatternUtils
public abstract class ResourcePatternUtils extends Object
Utility class for determining whether a given URL is a resource location that can be loaded via aResourcePatternResolver
.Callers will usually assume that a location is a relative path if the
isUrl(String)
method returnsfalse
.- Since:
- 1.2.3
- Author:
- Juergen Hoeller
Constructor Summary
Constructors Constructor Description ResourcePatternUtils()
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourcePatternResolver
getResourcePatternResolver(ResourceLoader resourceLoader)
Return a defaultResourcePatternResolver
for the givenResourceLoader
.static boolean
isUrl(String resourceLocation)
Return whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.
Constructor Detail
ResourcePatternUtils
public ResourcePatternUtils()
Method Detail
isUrl
public static boolean isUrl(@Nullable String resourceLocation)
Return whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.- Parameters:
resourceLocation
- the location String to check- Returns:
- whether the location qualifies as a URL
- See Also:
ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
,ResourceUtils.CLASSPATH_URL_PREFIX
,ResourceUtils.isUrl(String)
,URL
getResourcePatternResolver
public static ResourcePatternResolver getResourcePatternResolver(@Nullable ResourceLoader resourceLoader)
Return a defaultResourcePatternResolver
for the givenResourceLoader
.This might be the
ResourceLoader
itself, if it implements theResourcePatternResolver
extension, or a defaultPathMatchingResourcePatternResolver
built on the givenResourceLoader
.- Parameters:
resourceLoader
- the ResourceLoader to build a pattern resolver for (may benull
to indicate a default ResourceLoader)- Returns:
- the ResourcePatternResolver
- See Also:
PathMatchingResourcePatternResolver