]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #38135:
authorJeremias Maerki <jeremias@apache.org>
Thu, 5 Jan 2006 14:00:50 +0000 (14:00 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 5 Jan 2006 14:00:50 +0000 (14:00 +0000)
Added support for RFC 2397 "data" URLs.
Submitted by: Richard Wheeldon <richardw.at.geoquip-rnd.demon.co.uk>

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@366184 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/FOURIResolver.java
status.xml
test/layoutengine/standard-testcases/external-graphic_rfc2397.xml [new file with mode: 0644]

index 5a72e2d12a7075768231d27f45cf4a6ded835715..0689514644d9da4859c543d27e5d3435bed68f58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-/* $Id$ */
+/* $Id$ */
 
 package org.apache.fop.apps;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -28,6 +29,9 @@ import javax.xml.transform.stream.StreamSource;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+// base64 support for "data" urls
+import org.apache.batik.util.Base64DecodeStream;
+
 /**
  * Provides FOP specific URI resolution.
  * This is the default URIResolver {@link FOUserAgent} will use unless overidden.
@@ -70,6 +74,8 @@ public class FOURIResolver
             } catch (MalformedURLException mfue) {
                 log.error("Could not convert filename to URL: " + mfue.getMessage(), mfue); 
             }
+        } else if (href.startsWith("data:")) {
+            return parseDataURI(href);
         } else {
             URL baseURL = toBaseURL(base);
             if (baseURL == null) {
@@ -151,5 +157,25 @@ public class FOURIResolver
         }
         return null;
     }
-    
+
+    /**
+     * Parses inline data URIs as generated by MS Word's XML export and FO stylesheet.
+     * @see <a href="http://www.ietf.org/rfc/rfc2397">RFC 2397</a>
+     */
+    private Source parseDataURI(String href) {
+        int commaPos = href.indexOf(',');
+        // header is of the form data:[<mediatype>][;base64]
+        String header = href.substring(0, commaPos);
+        String data = href.substring(commaPos + 1);
+        if (header.endsWith(";base64")) {
+            byte[] bytes = data.getBytes();
+            ByteArrayInputStream encodedStream = new ByteArrayInputStream(bytes);
+            Base64DecodeStream decodedStream = new Base64DecodeStream(encodedStream);
+            return new StreamSource(decodedStream);
+        } else {
+            //Note that this is not quite the full story here. But since we are only interested
+            //in base64-encoded binary data, the next line will probably never be called.
+            return new StreamSource(new java.io.StringReader(data));
+        }
+    }
 }
index a0a333cb042795d63c62a33d700965d61b69c038..7ef2d56fe8cc54561c86d352a90419d6720860c4 100644 (file)
@@ -27,6 +27,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="add" fixes-bug="38132" due-to="Richard Wheeldon">
+        Added support for RFC2397 "data" URLs.
+      </action>
       <action context="Code" dev="JM" type="fix" fixes-bug="38132">
         Bugfix: Certain border styles could lead to a NullPointerException.
       </action>
diff --git a/test/layoutengine/standard-testcases/external-graphic_rfc2397.xml b/test/layoutengine/standard-testcases/external-graphic_rfc2397.xml
new file mode 100644 (file)
index 0000000..7466a6e
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks external-graphics with RFC2397 "data" URLs.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="8in" page-height="8in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Image referenced by RFC 2397 "data" URL:</fo:block>
+          <fo:block>
+            <fo:external-graphic src="url(&quot;data:image/gif;base64, R0lGODlhGQIzANUAAOzs608OWhkWGfQCMURERLGfR1oNffPcXOS3UnZ3d8cIRpFoN94EOPROPq4K&#xA;UbQHKuDg4K1qaPB4RmsJP/T09IkJMpmCPMvMzHsMbJcLXrClfru7u/glOIiIiGtNJTUHQbAuMMyk&#xA;qXWAhY4uKpyprrKIeaqqqpmZmZE3V4mcpswiK7TDyc3FtoaVndfW0bJNOaMEJsEbdZ0UJmVmZ5+z&#xA;vVNWWN3Ly7ywmoGOlTMzM8XW272dmu7U2MMCKQAAAP///yH5BAAAAAAALAAAAAAZAjMAAAb/wJ9w&#xA;SCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+Dw7yQum8/otHrNbrvf8OdFFK/b7/i8fs/P5xIAUisX&#xA;PyYkfYiJiouMjY5lGz4+M4FOLi0mPykkGwB0j6ChoqOkpWgQHZI+BBBNJiuHLScJOIdDITs/ESMg&#xA;uhE8pRAbw8TDhCcEBKZRwsbLQs0brc/UTtGEXsWVYhAnqqvYSSc0OD84HSKc0CMMDBUDAw8y8A8l&#xA;ADs7242p36rK/FxMdBg4cA+/VWpQzUhGYEaHDVdOCOgHsRoTghgzTkt0UJmXbxXLCJuoKkdIIxda&#xA;0ECHI4WIiigUuGvXowcDeAxg9BjAAUSE/0fICOSQJCBZgh8At5BUtfFOx1M1+vXrQOUgyB8EVFG1&#xA;WESq1JN9nk6JpMrI1TMQIMzoJ4CMEQrpWiSYQSPdDxsOFCio0A5GOwY9HsAb0APGg8IqXpRYbC8R&#xA;2a1C+G0YK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&quot;)"/>EOG
+          </fo:block>
+          <fo:block>EOF</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="537000" xpath="//flow/block[2]/lineArea/viewport/@ipd"/>
+    <eval expected="537000" xpath="//flow/block[2]/lineArea/viewport/@ipda"/>
+    <eval expected="51000" xpath="//flow/block[2]/lineArea/viewport/@bpd"/>
+    <eval expected="51000" xpath="//flow/block[2]/lineArea/viewport/@bpda"/>
+  </checks>
+</testcase>