public class UrlModuleSourceProvider extends ModuleSourceProviderBase
NOT_MODIFIED
Constructor and Description |
---|
UrlModuleSourceProvider(java.lang.Iterable<java.net.URI> privilegedUris,
java.lang.Iterable<java.net.URI> fallbackUris)
Creates a new module script provider that loads modules against a set of
privileged and fallback URIs.
|
UrlModuleSourceProvider(java.lang.Iterable<java.net.URI> privilegedUris,
java.lang.Iterable<java.net.URI> fallbackUris,
UrlConnectionExpiryCalculator urlConnectionExpiryCalculator,
UrlConnectionSecurityDomainProvider urlConnectionSecurityDomainProvider)
Creates a new module script provider that loads modules against a set of
privileged and fallback URIs.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
entityNeedsRevalidation(java.lang.Object validator)
Override to determine whether according to the validator, the cached
module script needs revalidation.
|
protected ModuleSource |
loadFromActualUri(java.net.URI uri,
java.net.URI base,
java.lang.Object validator) |
protected ModuleSource |
loadFromFallbackLocations(java.lang.String moduleId,
java.lang.Object validator)
Override to obtain a module source from fallback locations.
|
protected ModuleSource |
loadFromPrivilegedLocations(java.lang.String moduleId,
java.lang.Object validator)
Override to obtain a module source from privileged locations.
|
protected ModuleSource |
loadFromUri(java.net.URI uri,
java.net.URI base,
java.lang.Object validator)
Override in a subclass to load a module script from a logical URI.
|
protected void |
onFailedClosingUrlConnection(java.net.URLConnection urlConnection,
java.io.IOException cause)
Override if you want to get notified if the URL connection fails to
close.
|
protected java.net.URLConnection |
openUrlConnection(java.net.URL url)
Can be overridden in subclasses to customize the URL connection opening
process.
|
loadSource, loadSource
public UrlModuleSourceProvider(java.lang.Iterable<java.net.URI> privilegedUris, java.lang.Iterable<java.net.URI> fallbackUris)
privilegedUris
- an iterable providing the privileged URIs. Can be
null if no privileged URIs are used.fallbackUris
- an iterable providing the fallback URIs. Can be
null if no fallback URIs are used.public UrlModuleSourceProvider(java.lang.Iterable<java.net.URI> privilegedUris, java.lang.Iterable<java.net.URI> fallbackUris, UrlConnectionExpiryCalculator urlConnectionExpiryCalculator, UrlConnectionSecurityDomainProvider urlConnectionSecurityDomainProvider)
privilegedUris
- an iterable providing the privileged URIs. Can be
null if no privileged URIs are used.fallbackUris
- an iterable providing the fallback URIs. Can be
null if no fallback URIs are used.urlConnectionExpiryCalculator
- the calculator object for heuristic
calculation of the resource expiry, used when no expiry is provided by
the server of the resource. Can be null, in which case the maximum age
of cached entries without validation will be zero.urlConnectionSecurityDomainProvider
- object that provides security
domain objects for the loaded sources. Can be null, in which case the
loaded sources will have no security domain associated with them.protected ModuleSource loadFromPrivilegedLocations(java.lang.String moduleId, java.lang.Object validator) throws java.io.IOException, java.net.URISyntaxException
ModuleSourceProviderBase
loadFromPrivilegedLocations
in class ModuleSourceProviderBase
moduleId
- the ID of the modulevalidator
- a validator that can be used to validate an existing
cached script. Can be null if there is no cached script available.ModuleSourceProvider.NOT_MODIFIED
if
the existing cached module script is still valid.java.io.IOException
- if the module script was found, but an I/O exception
prevented it from being loaded.java.net.URISyntaxException
- if the final URI could not be constructed.protected ModuleSource loadFromFallbackLocations(java.lang.String moduleId, java.lang.Object validator) throws java.io.IOException, java.net.URISyntaxException
ModuleSourceProviderBase
loadFromFallbackLocations
in class ModuleSourceProviderBase
moduleId
- the ID of the modulevalidator
- a validator that can be used to validate an existing
cached script. Can be null if there is no cached script available.ModuleSourceProvider.NOT_MODIFIED
if
the existing cached module script is still valid.java.io.IOException
- if the module script was found, but an I/O exception
prevented it from being loaded.java.net.URISyntaxException
- if the final URI could not be constructed.protected ModuleSource loadFromUri(java.net.URI uri, java.net.URI base, java.lang.Object validator) throws java.io.IOException, java.net.URISyntaxException
ModuleSourceProviderBase
loadFromUri
in class ModuleSourceProviderBase
uri
- the URI of the script, without file name extension.base
- the base URI the uri was resolved from.validator
- a validator that can be used to revalidate an existing
cached source at the URI. Can be null if there is no cached source
available.ModuleSourceProvider.NOT_MODIFIED
if it revalidated the existing
cached source against the URI.java.io.IOException
- if the module script was found, but an I/O exception
prevented it from being loaded.java.net.URISyntaxException
- if the final URI could not be constructedprotected ModuleSource loadFromActualUri(java.net.URI uri, java.net.URI base, java.lang.Object validator) throws java.io.IOException
java.io.IOException
protected void onFailedClosingUrlConnection(java.net.URLConnection urlConnection, java.io.IOException cause)
urlConnection
- the connectioncause
- the cause it failed to close.protected java.net.URLConnection openUrlConnection(java.net.URL url) throws java.io.IOException
URL.openConnection()
.url
- the URLjava.io.IOException
- if an I/O error occurs.protected boolean entityNeedsRevalidation(java.lang.Object validator)
ModuleSourceProviderBase
entityNeedsRevalidation
in class ModuleSourceProviderBase
validator
- the validator