public class FOURIResolver
extends java.lang.Object
implements javax.xml.transform.URIResolver
FOUserAgent will use unless overridden.URIResolver| Constructor and Description |
|---|
FOURIResolver()
Default constructor
|
FOURIResolver(boolean throwExceptions)
Additional constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyHttpBasicAuthentication(java.net.URLConnection connection,
java.lang.String username,
java.lang.String password)
This is a convenience method for users who want to override
updateURLConnection for HTTP basic authentication.
|
java.lang.String |
checkBaseURL(java.lang.String base)
Checks if the given base URL is acceptable.
|
javax.xml.transform.URIResolver |
getCustomURIResolver()
Returns the custom URI Resolver.
|
javax.xml.transform.Source |
resolve(java.lang.String href,
java.lang.String base)
Called by the processor through
FOUserAgent when it encounters an
uri in an external-graphic element. |
void |
setCustomURIResolver(javax.xml.transform.URIResolver resolver)
Sets the custom URI Resolver.
|
void |
setThrowExceptions(boolean throwExceptions) |
protected void |
updateURLConnection(java.net.URLConnection connection,
java.lang.String href)
This method allows you to set special values on a URLConnection just
before the connect() method is called.
|
public FOURIResolver()
public FOURIResolver(boolean throwExceptions)
throwExceptions - true if exceptions are to be thrown if the URIs cannot be
resolved.public java.lang.String checkBaseURL(java.lang.String base)
throws java.net.MalformedURLException
base - the base URL to checkjava.net.MalformedURLException - if there's a problem with a file URLpublic javax.xml.transform.Source resolve(java.lang.String href,
java.lang.String base)
throws javax.xml.transform.TransformerException
FOUserAgent when it encounters an
uri in an external-graphic element. (see also
URIResolver.resolve(String, String) This
resolver will allow URLs without a scheme, i.e. it assumes 'file:' as the
default scheme. It also allows relative URLs with scheme, e.g.
file:../../abc.jpg which is not strictly RFC compliant as long as the
scheme is the same as the scheme of the base URL. If the base URL is null
a 'file:' URL referencing the current directory is used as the base URL.
If the method is successful it will return a Source of type
StreamSource with its SystemID set to
the resolved URL used to open the underlying InputStream.resolve in interface javax.xml.transform.URIResolverhref - An href attribute, which may be relative or absolute.base - The base URI against which the first argument will be made
absolute if the absolute URI is required.Source object, or null if the href
cannot be resolved.javax.xml.transform.TransformerException - Never thrown by this implementation.URIResolver.resolve(String, String)protected void updateURLConnection(java.net.URLConnection connection,
java.lang.String href)
connection - the URLConnection instancehref - the original URIprotected void applyHttpBasicAuthentication(java.net.URLConnection connection,
java.lang.String username,
java.lang.String password)
connection - the URLConnection to set up for HTTP basic authenticationusername - the usernamepassword - the passwordpublic void setCustomURIResolver(javax.xml.transform.URIResolver resolver)
resolver - the new URI resolverpublic javax.xml.transform.URIResolver getCustomURIResolver()
public void setThrowExceptions(boolean throwExceptions)
throwExceptions - Whether or not to throw exceptions on resolution errorCopyright 1999-2012 The Apache Software Foundation. All Rights Reserved.