Class UrlModuleSourceProvider
- java.lang.Object
-
- org.mozilla.javascript.commonjs.module.provider.ModuleSourceProviderBase
-
- org.mozilla.javascript.commonjs.module.provider.UrlModuleSourceProvider
-
- All Implemented Interfaces:
java.io.Serializable
,ModuleSourceProvider
public class UrlModuleSourceProvider extends ModuleSourceProviderBase
A URL-based script provider that can load modules against a set of base privileged and fallback URIs. It is deliberately not named "URI provider" but a "URL provider" since it actually only works against those URIs that are URLs (and the JRE has a protocol handler for them). It creates cache validators that are suitable for use with both file: and http: URL protocols. Specifically, it is able to use both last-modified timestamps and ETags for cache revalidation, and follows the HTTP cache expiry calculation model, and allows for fallback heuristic expiry calculation when no server specified expiry is provided.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.mozilla.javascript.commonjs.module.provider.ModuleSourceProvider
NOT_MODIFIED
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
-
Methods inherited from class org.mozilla.javascript.commonjs.module.provider.ModuleSourceProviderBase
loadSource, loadSource
-
-
-
-
Constructor Detail
-
UrlModuleSourceProvider
public 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. It will use a fixed default cache expiry of 60 seconds, and provide no security domain objects for the resource.- Parameters:
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.
-
UrlModuleSourceProvider
public 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. It will use the specified heuristic cache expiry calculator and security domain provider.- Parameters:
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.
-
-