commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Negoda <...@cdev.ru>
Subject commons-vfs removes queryString from URLs
Date Fri, 29 Sep 2006 05:10:27 GMT
Hi,

When I try to fetch URL like "http://...?queryString" it actually performs query "http://...",
without 'queryString'. Moreover, URLFileName.getPathQuery returns '?null' at the end if no
query specified. The following patch fixed these two problems:

Index: src/java/org/apache/commons/vfs/provider/URLFileName.java
===================================================================
--- src/java/org/apache/commons/vfs/provider/URLFileName.java   (revision 446600)
+++ src/java/org/apache/commons/vfs/provider/URLFileName.java   (working copy)
@@ -43,8 +43,10 @@
     {
         StringBuffer sb = new StringBuffer(250);
         sb.append(getPath());
-        sb.append("?");
-        sb.append(getQueryString());
+        if (getQueryString() != null) {
+            sb.append("?");
+            sb.append(getQueryString());
+        }
 
         return sb.toString();
     }

Index: src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
===================================================================
--- src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java       (revision
446600)
+++ src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java       (working
copy)
@@ -78,7 +78,7 @@
         }
 
         // Locate the file
-        return fs.resolveFile(name.getPath());
+        return fs.resolveFile(name instanceof URLFileName ? ((URLFileName)name).getPathQuery()
: name.getPath());
     }
 
     /**

-- 
Sincerely yours,
Dmitry Negoda
Lead developer

SALES-N-STATS.COM
Glavpochtamt, p/o box 5152.   [web site] http://www.sales-n-stats.com/
432072 Ulyanovsk, Russia      [ phone  ] +7-(8422)-429038 (9:00-18:00 GMT +4)
                              [ fax    ]  1-270-568-5165



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message