From 67a9815afa925606d13e13488e5539a57deb5bb2 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 29 Jun 2007 12:46:14 +0000 Subject: Bugzilla #42278: Refactoring of color map cache and uri/fo resolution from FopFactory Submitted by: Adrian Cumiskey Changes in addition to the patch by jeremias: - Moved the color map cache to the util package so it doesn't clutter the API (apps) package. - Factored out the data URL resolution into its own URIResolver class which can now be used separately. - Added a utility class for generating RFC2397 data URLs. - Added a unit test for data URL handling. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@551874 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/FOUserAgent.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/java/org/apache/fop/apps/FOUserAgent.java') diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 24df2f75b..33106ee12 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -361,26 +361,27 @@ public class FOUserAgent { * Attempts to resolve the given URI. * Will use the configured resolver and if not successful fall back * to the default resolver. - * @param uri URI to access + * @param href URI to access * @param base the base URI to resolve against * @return A {@link javax.xml.transform.Source} object, or null if the URI * cannot be resolved. * @see org.apache.fop.apps.FOURIResolver */ - public Source resolveURI(String uri, String base) { + public Source resolveURI(String href, String base) { Source source = null; - //RFC 2397 data URLs don't need to be resolved, just decode them. - boolean bypassURIResolution = uri.startsWith("data:"); + //RFC 2397 data URLs don't need to be resolved, just decode them through FOP's default + //URIResolver. + boolean bypassURIResolution = href.startsWith("data:"); if (!bypassURIResolution && uriResolver != null) { try { - source = uriResolver.resolve(uri, base); + source = uriResolver.resolve(href, base); } catch (TransformerException te) { - log.error("Attempt to resolve URI '" + uri + "' failed: ", te); + log.error("Attempt to resolve URI '" + href + "' failed: ", te); } } if (source == null) { // URI Resolver not configured or returned null, use default resolver from the factory - source = getFactory().resolveURI(uri, base); + source = getFactory().resolveURI(href, base); } return source; } -- cgit v1.2.3