You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2008/06/16 06:53:50 UTC

svn commit: r668055 - in /xmlgraphics/batik/trunk: CHANGES sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java sources/org/apache/batik/util/ParsedURL.java sources/org/apache/batik/util/ParsedURLData.java

Author: cam
Date: Sun Jun 15 21:53:49 2008
New Revision: 668055

URL: http://svn.apache.org/viewvc?rev=668055&view=rev
Log:
Make the location bar and Document.documentURL be the post-HTTP-redirect URL.
Closes bug 44919.

Modified:
    xmlgraphics/batik/trunk/CHANGES
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java

Modified: xmlgraphics/batik/trunk/CHANGES
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/CHANGES?rev=668055&r1=668054&r2=668055&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/CHANGES (original)
+++ xmlgraphics/batik/trunk/CHANGES Sun Jun 15 21:53:49 2008
@@ -9,7 +9,7 @@
 
 1. Bugzilla problem reports fixed:
 
-    44590, 44936, 44966, 45112, 45114, 45117
+    44590, 44919, 44936, 44966, 45112, 45114, 45117
 
 2. New features
 
@@ -22,6 +22,8 @@
     properties of the DocumentType object are filled in).
   * Dynamically created <script> elements inserted into the document are
     now executed (at most once, as with HTML).
+  * The location bar in Squiggle is now updated if the requested document
+    followed an HTTP redirect.
 
 4. Bug fixes
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java?rev=668055&r1=668054&r2=668055&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java Sun Jun 15 21:53:49 2008
@@ -156,6 +156,7 @@
         ParsedURL purl = new ParsedURL(uri);
 
         InputStream is = purl.openStream(MimeTypeConstants.MIME_TYPES_SVG);
+        uri = purl.getPostConnectionURL();
 
         InputSource isrc = new InputSource(is);
 
@@ -199,7 +200,7 @@
 
         SVGOMDocument doc = (SVGOMDocument) super.createDocument
             (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, isrc);
-        doc.setParsedURL(purl);
+        doc.setParsedURL(new ParsedURL(uri));
         doc.setDocumentInputEncoding(charset);
         doc.setXmlStandalone(isStandalone);
         doc.setXmlVersion(xmlVersion);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java?rev=668055&r1=668054&r2=668055&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java Sun Jun 15 21:53:49 2008
@@ -246,6 +246,17 @@
     }
 
     /**
+     * Returns the URL that was ultimately used to fetch the resource
+     * represented by this <code>ParsedURL</code>.  For HTTP URLs,
+     * this will result in the post-redirect URL being returned.
+     * If there was no redirect, or if this isn't an HTTP URL, the
+     * original URL is returned (the same string as {@link toString()}).
+     */
+    public String getPostConnectionURL() {
+        return data.getPostConnectionURL();
+    }
+
+    /**
      * Implement Object.equals.
      * Relies heavily on the contained ParsedURLData's implementation
      * of equals.
@@ -269,7 +280,7 @@
 
     /**
      * Returns true if the URL looks well formed and complete.
-     * This does not garuntee that the stream can be opened but
+     * This does not guarantee that the stream can be opened but
      * is a good indication that things aren't totally messed up.
      */
     public boolean complete() {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java?rev=668055&r1=668054&r2=668055&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java Sun Jun 15 21:53:49 2008
@@ -139,6 +139,11 @@
     protected String contentTypeCharset;
 
     /**
+     * The URL that was ultimately used to fetch the resource.
+     */
+    protected URL postConnectionURL;
+
+    /**
      * Void constructor
      */
     public ParsedURLData() {
@@ -540,8 +545,9 @@
                                         encodingHeader);
             }
 
-            contentType     = urlC.getContentType();
-            contentEncoding = urlC.getContentEncoding();
+            contentType       = urlC.getContentType();
+            contentEncoding   = urlC.getContentEncoding();
+            postConnectionURL = urlC.getURL();
         }
 
         return (stream = urlC.getInputStream());
@@ -596,5 +602,19 @@
 
         return ret;
     }
+
+    /**
+     * Returns the URL that was ultimately used to fetch the resource
+     * represented by the <code>ParsedURL</code>.
+     */
+    public String getPostConnectionURL() {
+        if (postConnectionURL != null) {
+            if (ref != null) {
+                return postConnectionURL.toString() + '#' + ref;
+            }
+            return postConnectionURL.toString();
+        }
+        return toString();
+    }
 }