Class CatalogResolver
- All Implemented Interfaces:
ResourceResolver
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of ResourceResolver using a default configuration.Creates a new instance of ResourceResolver with the specified resolver configuration. -
Method Summary
Modifier and TypeMethodDescriptionReturns theXMLResolverConfiguration
used by this ResourceResolver.resolveEntity
(String name, String publicId, String systemId, String baseURI) Resolve external identifiers and other entity-like resources.resolveNamespace
(String uri, String baseURI, String nature, String purpose) Resolve a Namespace URI.resolveURI
(String href, String baseURI) Resolve a URI.protected ResolvedResourceImpl
resource
(String requestURI, URI responseURI, CacheEntry cached) protected ResolvedResourceImpl
uncachedResource
(URI req, URI res)
-
Field Details
-
FOLLOW_REDIRECT_LIMIT
public static final int FOLLOW_REDIRECT_LIMIT- See Also:
-
-
Constructor Details
-
CatalogResolver
public CatalogResolver()Creates a new instance of ResourceResolver using a default configuration. -
CatalogResolver
Creates a new instance of ResourceResolver with the specified resolver configuration.- Parameters:
conf
- TheXMLResolverConfiguration
to use.- Throws:
NullPointerException
- if the configuration is null.
-
-
Method Details
-
getConfiguration
Returns theXMLResolverConfiguration
used by this ResourceResolver.- Specified by:
getConfiguration
in interfaceResourceResolver
- Returns:
- The configuration.
-
resolveURI
Resolve a URI.The catalog is interrogated for the specified
href
. If it is found, its mapping is returned. Otherwise, thehref
is made absolute with respect to the specifiedbase
and the catalog is interrogated for the resulting absolute URI. If it is found, its mapping is returned.- Specified by:
resolveURI
in interfaceResourceResolver
- Parameters:
href
- The URI of the resourcebaseURI
- The base URI against whichhref
should be made absolute, if necessary.- Returns:
- The resolved resource or null if no resolution was possible.
- Throws:
IllegalArgumentException
- if the THROW_URI_EXCEPTIONS feature is true and an exception occurs resolving a URI.
-
resolveEntity
public ResolvedResource resolveEntity(String name, String publicId, String systemId, String baseURI) Resolve external identifiers and other entity-like resources.If the systemId is null and the baseURI is not, the systemId is taken to be the baseURI and the baseURI is treated as if it were null.
If name, publicId and systemId are all null, null is returned.
If systemId or publicId are not null, the method attempts to resolve an external identifier with the specified external identifier and the (possibly null) name and publicId. (Because public identifiers can be encoded in URNs, it's possible for this method to receive a publicId and not a systemId, even in XML systems.)
If name is not null, but systemId is, name is assumed to be document type name and the method attempts to resolve an external identifier that matches. A
doctype
catalog entry, for example.If the systemId is relative, resolution fails, and baseURI is not null, the systemId is made absolute with respect to the baseURI and resolution is attempted a second time.
- Specified by:
resolveEntity
in interfaceResourceResolver
- Parameters:
name
- The possibly null entity (or document type) name.publicId
- The possibly null public identifier.systemId
- The possibly relative system identifier to resolve.baseURI
- The possibly null base URI to use if systemId is relative and not resolved.- Returns:
- The resolved resource or null if no resolution was possible.
- Throws:
IllegalArgumentException
- if the THROW_URI_EXCEPTIONS feature is true and an exception occurs resolving a URI.
-
resolveNamespace
Resolve a Namespace URI.The catalog is interrogated for the specified namespace. If it is found, it is returned.
The resolver attempts to parse the resource as an XML document. If it finds RDDL 1.0 markup, it will attempt to locate the resource with the specified nature and purpose. That resource will be downloaded and returned. If it cannot parse the document or cannot find the markup that it is looking for, it will return the resource that represents the namespace URI.
- Specified by:
resolveNamespace
in interfaceResourceResolver
- Parameters:
uri
- The namespace URI.baseURI
- The base URI of the resource.nature
- The RDDL nature of the resource.purpose
- The RDDL purpose of the resource.- Returns:
- The resolved resource or null if no resolution was possible.
- Throws:
IllegalArgumentException
- if the THROW_URI_EXCEPTIONS feature is true and an exception occurs resolving a URI.
-
resource
-
uncachedResource
protected ResolvedResourceImpl uncachedResource(URI req, URI res) throws IOException, URISyntaxException - Throws:
IOException
URISyntaxException
-