Class ResourceLoader
-
- All Implemented Interfaces:
public abstract class ResourceLoader<T extends Object>The base
ResourceLoaderclass.Peter Wall
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classResourceLoader.AuthorizationFilterpublic final classResourceLoader.RedirectionFilterpublic final classResourceLoader.PrefixRedirectionFilterpublic classResourceLoader.Companion
-
Field Summary
Fields Modifier and Type Field Description private final URLbaseURLprivate final StringdefaultExtensionprivate final StringdefaultMIMETypepublic final static ResourceLoader.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description ResourceLoader()
-
Method Summary
Modifier and Type Method Description final URLgetBaseURL()StringgetDefaultExtension()StringgetDefaultMIMEType()abstract Tload(ResourceDescriptor rd)Load the resource, that is, read the external representation of the resource from the InputStreamin the ResourceDescriptor and return the internal form.Tload(Resource<T> resource)Load the resource identified by the specified Resource. final Tload(URL resourceURL)Load the resource identified by the specified URL. final Resource<T>resource(File resourceFile)Get a Resource, specifying a File. final Resource<T>resource(Path resourcePath)Get a Resource, specifying a Path. final Resource<T>resource(URL resourceURL)Get a Resource, specifying a URL. ResourceDescriptoropenResource(Resource<T> resource)Open a Resource for reading. final StringaddExtension(String s)Add the default extension to a file name or URL string. final UnitaddConnectionFilter(Function1<URLConnection, URLConnection> filter)Add a connection filter for HTTP connections. final UnitaddAuthorizationFilter(String host, String headerName, String headerValue)Add an authorization filter for HTTP connections. final UnitaddAuthorizationFilter(Wildcard hostWildcard, String headerName, String headerValue)Add an authorization filter for HTTP connections (specifying a wildcarded hostname). final UnitaddRedirectionFilter(String fromHost, Integer fromPort, String toHost, Integer toPort)Add a redirection filter for HTTP connections. final UnitaddRedirectionFilter(String fromPrefix, String toPrefix)Add a redirection filter for prefix-based redirections. -
-
Method Detail
-
getBaseURL
final URL getBaseURL()
-
getDefaultExtension
String getDefaultExtension()
-
getDefaultMIMEType
String getDefaultMIMEType()
-
load
abstract T load(ResourceDescriptor rd)
Load the resource, that is, read the external representation of the resource from the
InputStreamin the ResourceDescriptor and return the internal form.
-
load
T load(Resource<T> resource)
Load the resource identified by the specified Resource. This function is open for extension to allow, for example, caching implementations to provide a returned resource bypassing the regular mechanism.
-
openResource
ResourceDescriptor openResource(Resource<T> resource)
Open a Resource for reading. This function is open for extension to allow non-standard URLs to be mapped to actual resources. The result of this function is a ResourceDescriptor, which contains an open
InputStreamand all the metadata known about the resource.
-
addExtension
final String addExtension(String s)
Add the default extension to a file name or URL string.
-
addConnectionFilter
final Unit addConnectionFilter(Function1<URLConnection, URLConnection> filter)
Add a connection filter for HTTP connections.
-
addAuthorizationFilter
final Unit addAuthorizationFilter(String host, String headerName, String headerValue)
Add an authorization filter for HTTP connections.
-
addAuthorizationFilter
final Unit addAuthorizationFilter(Wildcard hostWildcard, String headerName, String headerValue)
Add an authorization filter for HTTP connections (specifying a wildcarded hostname).
-
addRedirectionFilter
final Unit addRedirectionFilter(String fromHost, Integer fromPort, String toHost, Integer toPort)
Add a redirection filter for HTTP connections.
-
addRedirectionFilter
final Unit addRedirectionFilter(String fromPrefix, String toPrefix)
Add a redirection filter for prefix-based redirections.
-
-
-
-