|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.net.URILocatorResolver
A generic URI locator resolver. Uses a plugin architecture to handle different URI protocols. The steps in resolution are as follows: 1. If the Locator is not an instance of URILocator, a LocatorResolutionException is thrown 2. If a LocatorResolver is registered for the scheme of the URILocator, then this resolver is invoked and the resulting InputStream returned 3. If there is no LocatorResolver found for the scheme, then the address is used to construct a java.net.URL object and an attempt is made to open a connection to the URL using the standard Java mechanism
If provided with a CatalogResolver
(either at construction or via
setCatalogResolver(CatalogResolver)
, resolution of Locator
addresses will be attempted prior to opening a resource.
URILocator
,
LocatorResolutionException
,
URL
,
URLConnection
Field Summary | |
protected org.apache.xml.resolver.tools.CatalogResolver |
m_catalogResolver
XML catalog resolution service. |
Constructor Summary | |
URILocatorResolver()
A default constructor establishing a URILocatorResolver. |
|
URILocatorResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
A constructor establishing a URILocatorResolver that provides XML catalog resolution. |
Method Summary | |
LocatorResolver |
addResolver(java.lang.String scheme,
LocatorResolver resolver)
Adds a new protocol resolver to this resolver. |
java.io.InputStream |
resolve(Locator loc)
Opens an InputStream from the resource specified by the Locator's address. |
void |
setCatalogResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
Set the CatalogResolver used with this URILocatorResolver. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.xml.resolver.tools.CatalogResolver m_catalogResolver
Constructor Detail |
public URILocatorResolver()
public URILocatorResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
resolver
- the CatalogResolver to be used.Method Detail |
public void setCatalogResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
resolver
- the CatalogResolver to be used.public LocatorResolver addResolver(java.lang.String scheme, LocatorResolver resolver)
scheme
- The URI scheme handled by the resolver.resolver
- The LocatorResolver capable of providing an InputStream
for URIs using the scheme scheme
scheme
or
null if there was no previously registered resolver for this
scheme.public java.io.InputStream resolve(Locator loc) throws java.io.IOException, LocatorResolutionException
resolve
in interface LocatorResolver
loc
- the locator for which an input stream is to be opened.
LocatorResolutionException
- if the locator could not be resolved
correctly.
java.io.IOException
- if an unexpected condition occurred while attempting
to open the input stream.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |