Interface ResourceResolver
-
- All Known Implementing Classes:
CatalogResourceResolver
,ChainedResourceResolver
,DirectResourceResolver
,ResourceResolverDelegate
,ResourceResolverWrappingLSResourceResolver
,ResourceResolverWrappingURIResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ResourceResolver
Interface for processing a resource request to deliver a resourceIt is a common feature of existing resolver APIs that they chain together. For example, it is often the case that when a new
EntityResolver
is added to anXMLReader
, it is configured so that the existing (possibly underlying, implementation defined) resolver will be called if the newly specified resolver fails to resolve the URI. TwoResourceResolvers
can be chained together into a singleResourceResolver
by using theChainedResourceResolver
class.The resolver methods in this class will generally return
null
if the requested resource could not be found. If instead the caller wants a failure to get the resource to be treated as an error, it is possible to request this by setting a property on theCatalogResourceResolver
.The usual mechanism for resolving a URI is to create a
ResourceRequest
, and pass it to a sequence ofResourceResolver
s using the methodResourceRequest.resolve(net.sf.saxon.lib.ResourceResolver...)
. This will invoke each resolver in turn until one of them returns a non-null result.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.xml.transform.Source
resolve(ResourceRequest request)
Process a resource request to deliver a resource
-
-
-
Method Detail
-
resolve
javax.xml.transform.Source resolve(ResourceRequest request) throws XPathException
Process a resource request to deliver a resource- Parameters:
request
- the resource request- Returns:
- the returned Source; or null to delegate resolution to another resolver. The type of Source
must correspond to the type of resource requested: for non-XML resources, it should generally be a
StreamSource
. - Throws:
XPathException
- if the request is invalid in some way, or if the identified resource is unsuitable, or if resolution is to fail rather than being delegated to another resolver.
-
-