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 StringdefaultExtensionprivate final StringdefaultMIMETypeprivate final URLbaseURLpublic final static ResourceLoader.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description ResourceLoader(URL baseURL)
-
Method Summary
Modifier and Type Method Description StringgetDefaultExtension()StringgetDefaultMIMEType()final URLgetBaseURL()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 Tload(String resourceId)Load the resource identified by an identifier string, which is resolved against the base URL. final Resource<T>resource(File file)Get a Resource, specifying a File. final Resource<T>resource(Path path)Get a Resource, specifying a Path. final Resource<T>resource(URL url)Get a Resource, specifying a URL. final SyntheticResource<T>syntheticResource(String name, T value)Create a SyntheticResource, specifying the name and value. 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(StringMatcher hostMatcher, String headerName, String headerValue)Add an authorization filter for HTTP connections (specifying a StringMatcher for hostname). final UnitaddRedirectionFilter(String fromHost, Integer fromPort, String toHost, Integer toPort)Add a redirection filter for HTTP connections. final UnitaddRedirectionFilter(StringMatcher fromHostMatcher, Integer fromPort, String toHost, Integer toPort)Add a redirection filter for HTTP connections (specifying a StringMatcher for hostname). final UnitaddPrefixRedirectionFilter(String fromPrefix, String toPrefix)Add a redirection filter for prefix-based redirections. -
-
Constructor Detail
-
ResourceLoader
ResourceLoader(URL baseURL)
-
-
Method Detail
-
getDefaultExtension
String getDefaultExtension()
-
getDefaultMIMEType
String getDefaultMIMEType()
-
getBaseURL
final URL getBaseURL()
-
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.
-
load
final T load(String resourceId)
Load the resource identified by an identifier string, which is resolved against the base URL.
-
syntheticResource
final SyntheticResource<T> syntheticResource(String name, T value)
Create a SyntheticResource, specifying the name and value.
-
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(StringMatcher hostMatcher, String headerName, String headerValue)
Add an authorization filter for HTTP connections (specifying a StringMatcher for hostname).
-
addRedirectionFilter
final Unit addRedirectionFilter(String fromHost, Integer fromPort, String toHost, Integer toPort)
Add a redirection filter for HTTP connections.
-
addRedirectionFilter
final Unit addRedirectionFilter(StringMatcher fromHostMatcher, Integer fromPort, String toHost, Integer toPort)
Add a redirection filter for HTTP connections (specifying a StringMatcher for hostname).
-
addPrefixRedirectionFilter
final Unit addPrefixRedirectionFilter(String fromPrefix, String toPrefix)
Add a redirection filter for prefix-based redirections.
-
-
-
-