public class ResourceResolver
extends java.lang.Object
ResourceLoader instances.| Constructor and Description |
|---|
ResourceResolver()
Default constructor.
|
ResourceResolver(java.util.List<ResourceLoader> resourceLoaders) |
ResourceResolver(ResourceLoader[] resourceLoaders) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ResourceLoader> |
getLoader(java.lang.Class<T> resolverType)
Searches resource loaders for one that matches or is a subclass of the specified type.
|
java.util.Optional<ResourceLoader> |
getLoaderForBasePath(java.lang.String basePath)
Searches resource loaders for one that supports the given path.
|
java.util.Optional<java.net.URL> |
getResource(java.lang.String path)
Searches resource loaders for one that supports the given path.
|
java.util.Optional<java.io.InputStream> |
getResourceAsStream(java.lang.String path)
Searches resource loaders for one that supports the given path.
|
java.util.stream.Stream<java.net.URL> |
getResources(java.lang.String path)
Searches resource loaders for one that supports the given path.
|
java.util.Optional<ResourceLoader> |
getSupportingLoader(java.lang.String prefix)
Searches resource loaders for one that supports the given prefix.
|
public ResourceResolver(@NonNull ResourceLoader[] resourceLoaders)
resourceLoaders - The resource loaderspublic ResourceResolver(@NonNull java.util.List<ResourceLoader> resourceLoaders)
resourceLoaders - The resource loaderspublic ResourceResolver()
@NonNull public <T extends ResourceLoader> java.util.Optional<T> getLoader(@NonNull java.lang.Class<T> resolverType)
T - The typeresolverType - The type of resolver to retrieve@NonNull public java.util.Optional<ResourceLoader> getSupportingLoader(@NonNull java.lang.String prefix)
prefix - The prefix the loader should support. (classpath:, file:, etc)@NonNull public java.util.Optional<ResourceLoader> getLoaderForBasePath(@NonNull java.lang.String basePath)
basePath - The path to load resources from@NonNull public java.util.Optional<java.io.InputStream> getResourceAsStream(@NonNull java.lang.String path)
path - The path to the resource@NonNull public java.util.Optional<java.net.URL> getResource(@NonNull java.lang.String path)
path - The path to the resource