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

public abstract Class ResourcePatternUtils

extends Object
Class Inheritance
Imports
org.springframework.core.io.ResourceLoader, org.springframework.lang.Nullable, org.springframework.util.ResourceUtils

Utility class for determining whether a given URL is a resource location that can be loaded via a ResourcePatternResolver.

Callers will usually assume that a location is a relative path if the isUrl(String) method returns false.

Author
Juergen Hoeller
Since
1.2.3

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ResourcePatternResolver

Returns:

the ResourcePatternResolver
getResourcePatternResolver
(ResourceLoader
the ResourceLoader to build a pattern resolver for (may be null to indicate a default ResourceLoader)
resourceLoader
)

Return a default ResourcePatternResolver for the given ResourceLoader.

public static boolean

Returns:

whether the location qualifies as a URL
isUrl
(String
the location String to check
resourceLocation
)

Return whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ResourcePatternUtilsback to summary
public ResourcePatternUtils()

Method Detail

getResourcePatternResolverback to summary
public static ResourcePatternResolver getResourcePatternResolver(ResourceLoader resourceLoader)

Return a default ResourcePatternResolver for the given ResourceLoader.

This might be the ResourceLoader itself, if it implements the ResourcePatternResolver extension, or a default PathMatchingResourcePatternResolver built on the given ResourceLoader.

Parameters
resourceLoader:ResourceLoader

the ResourceLoader to build a pattern resolver for (may be null to indicate a default ResourceLoader)

Returns:ResourcePatternResolver

the ResourcePatternResolver

See Also
PathMatchingResourcePatternResolver
isUrlback to summary
public 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.

Parameters
resourceLocation:String

the location String to check

Returns:boolean

whether the location qualifies as a URL

See Also
ResourcePatternResolver#CLASSPATH_ALL_URL_PREFIX, org.springframework.util.ResourceUtils#CLASSPATH_URL_PREFIX, org.springframework.util.ResourceUtils#isUrl(String), java.net.URL