You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/07/23 17:29:06 UTC

svn commit: r1364679 - in /commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider: http/HttpFileObject.java webdav/WebdavFileObject.java

Author: ggregory
Date: Mon Jul 23 15:29:05 2012
New Revision: 1364679

URL: http://svn.apache.org/viewvc?rev=1364679&view=rev
Log:
Reuse org.apache.commons.vfs2.provider.http.HttpFileObject.urlCharset in WebDAV subclass through new accessor method.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java?rev=1364679&r1=1364678&r2=1364679&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java Mon Jul 23 15:29:05 2012
@@ -177,7 +177,7 @@ public class HttpFileObject extends Abst
      */
     protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException
     {
-        String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(urlCharset);
+        String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset());
         method.setPath(pathEncoded);
         method.setFollowRedirects(this.getFollowRedirect());
         method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS");
@@ -225,6 +225,11 @@ public class HttpFileObject extends Abst
         return followRedirect;
     }
 
+    protected String getUrlCharset()
+    {
+        return urlCharset;
+    }
+
     HeadMethod getHeadMethod() throws IOException
     {
         if (method != null) {

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java?rev=1364679&r1=1364678&r2=1364679&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java Mon Jul 23 15:29:05 2012
@@ -85,7 +85,6 @@ public class WebdavFileObject extends Ht
             "response-charset");
 
     private final WebdavFileSystem fileSystem;
-    private final String urlCharset;
 
     /** The FileSystemConfigBuilder */
     private final WebdavFileSystemConfigBuilder builder;
@@ -95,8 +94,6 @@ public class WebdavFileObject extends Ht
         super(name, fileSystem, WebdavFileSystemConfigBuilder.getInstance());
         this.fileSystem = fileSystem;
         builder = (WebdavFileSystemConfigBuilder) WebdavFileSystemConfigBuilder.getInstance();
-        final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions();
-        this.urlCharset = builder.getUrlCharset(fileSystemOptions);
     }
 
     protected void configureMethod(HttpMethodBase httpMethod)
@@ -394,7 +391,7 @@ public class WebdavFileObject extends Ht
     @Override
     protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException
     {
-        String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(urlCharset);
+        String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset());
         method.setPath(pathEncoded);
         method.setFollowRedirects(this.getFollowRedirect());
         method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS");
@@ -575,7 +572,7 @@ public class WebdavFileObject extends Ht
                 name.getPath(), name.getType(), name.getQueryString());
         try
         {
-            return newFile.getURIEncoded(urlCharset);
+            return newFile.getURIEncoded(this.getUrlCharset());
         }
         catch (Exception e)
         {
@@ -606,7 +603,7 @@ public class WebdavFileObject extends Ht
                 name.getPath(), name.getType(), name.getQueryString());
         try
         {
-            return newFile.getURIEncoded(urlCharset);
+            return newFile.getURIEncoded(this.getUrlCharset());
         }
         catch (Exception e)
         {