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