juergen 2003/04/03 07:51:58
Modified: src/webdav/client/src/org/apache/webdav/lib/methods
GetMethod.java HeadMethod.java
HttpRequestBodyMethodBase.java MkcolMethod.java
PutMethod.java UnlockMethod.java
Log:
I18N change: the new http client expects the urls already encoded, the webdav API
encodes the url string as a service.
Revision Changes Path
1.15 +42 -13
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- GetMethod.java 16 Dec 2002 15:17:28 -0000 1.14
+++ GetMethod.java 3 Apr 2003 15:51:56 -0000 1.15
@@ -60,10 +60,11 @@
* [Additional notices, if required by prior licensing conditions]
*
*/
-
+
package org.apache.webdav.lib.methods;
import java.io.File;
+import org.apache.util.URLUtil;
/**
* GET Method.
@@ -75,32 +76,32 @@
extends org.apache.commons.httpclient.methods.GetMethod {
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* Method constructor.
*/
public GetMethod() {
super();
}
-
-
+
+
/**
* Method constructor.
*/
public GetMethod(String path) {
super(path);
}
-
-
+
+
/**
* Method constructor.
*/
public GetMethod(String path, String tempDir) {
super(path, tempDir);
}
-
-
+
+
/**
* Method constructor.
*/
@@ -114,7 +115,35 @@
public GetMethod(String path, File fileData) {
super(path, fileData);
}
-
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
}
1.11 +43 -11
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/HeadMethod.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HeadMethod.java 25 Apr 2002 21:12:29 -0000 1.10
+++ HeadMethod.java 3 Apr 2003 15:51:56 -0000 1.11
@@ -60,7 +60,7 @@
* [Additional notices, if required by prior licensing conditions]
*
*/
-
+
package org.apache.webdav.lib.methods;
@@ -70,29 +70,61 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author <a href="mailto:[EMAIL PROTECTED]">B.C. Holmes</a>
*/
+import org.apache.util.URLUtil;
+
public class HeadMethod
extends org.apache.commons.httpclient.methods.HeadMethod {
-
+
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* Method constructor.
*/
public HeadMethod() {
super();
}
-
-
+
+
/**
* Method constructor.
*/
public HeadMethod(String path) {
super(path);
}
-
-
+
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
+
+
}
1.5 +36 -16
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java
Index: HttpRequestBodyMethodBase.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HttpRequestBodyMethodBase.java 27 Feb 2003 10:58:26 -0000 1.4
+++ HttpRequestBodyMethodBase.java 3 Apr 2003 15:51:57 -0000 1.5
@@ -62,20 +62,11 @@
package org.apache.webdav.lib.methods;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
+import org.apache.commons.httpclient.*;
+
import java.net.URL;
-import org.apache.commons.httpclient.HttpConnection;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpState;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.HttpConstants;
+import org.apache.util.URLUtil;
/**
@@ -133,6 +124,35 @@
// --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
/**
1.9 +49 -19
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MkcolMethod.java
Index: MkcolMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MkcolMethod.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MkcolMethod.java 16 Dec 2002 15:17:28 -0000 1.8
+++ MkcolMethod.java 3 Apr 2003 15:51:57 -0000 1.9
@@ -60,13 +60,13 @@
* [Additional notices, if required by prior licensing conditions]
*
*/
-
+
package org.apache.webdav.lib.methods;
-import java.io.InputStream;
import java.io.IOException;
-
+import java.io.InputStream;
import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.util.URLUtil;
/**
* The MKCOL method is used to create a new collection. All DAV compliant
@@ -106,29 +106,29 @@
*/
public class MkcolMethod
extends HttpMethodBase {
-
-
+
+
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* Method constructor.
*/
public MkcolMethod() {
}
-
-
+
+
/**
* Method constructor.
*/
public MkcolMethod(String path) {
super(path);
}
-
-
+
+
// --------------------------------------------------- WebdavMethod Methods
-
-
+
+
/**
* Parse the response body. The MKCOL method does not receive a response
* body.
@@ -139,8 +139,38 @@
throws IOException {
}
- public String getName() {
- return "MKCOL";
- }
+ public String getName() {
+ return "MKCOL";
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
+
}
1.14 +41 -9
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PutMethod.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PutMethod.java 25 Apr 2002 21:27:30 -0000 1.13
+++ PutMethod.java 3 Apr 2003 15:51:57 -0000 1.14
@@ -60,7 +60,7 @@
* [Additional notices, if required by prior licensing conditions]
*
*/
-
+
package org.apache.webdav.lib.methods;
@@ -71,27 +71,59 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author <a href="mailto:[EMAIL PROTECTED]">B.C. Holmes</a>
*/
+import org.apache.util.URLUtil;
+
public class PutMethod
extends org.apache.commons.httpclient.methods.PutMethod {
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* Method constructor.
*/
public PutMethod() {
super();
}
-
-
+
+
/**
* Method constructor.
*/
public PutMethod(String path) {
super(path);
}
-
+
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
+
1.16 +56 -24
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UnlockMethod.java
Index: UnlockMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UnlockMethod.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- UnlockMethod.java 16 Dec 2002 15:17:28 -0000 1.15
+++ UnlockMethod.java 3 Apr 2003 15:51:57 -0000 1.16
@@ -60,14 +60,16 @@
* [Additional notices, if required by prior licensing conditions]
*
*/
-
+
package org.apache.webdav.lib.methods;
-import java.io.InputStream;
import java.io.IOException;
-
-import org.apache.commons.httpclient.*;
-
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.util.URLUtil;
import org.apache.webdav.lib.WebdavState;
/**
@@ -78,17 +80,17 @@
*/
public class UnlockMethod
extends HttpMethodBase {
-
-
+
+
// ----------------------------------------------------- Instance Variables
-
+
private String lockToken = null;
-
+
// ----------------------------------------------------------- Constructors
-
-
+
+
/**
* Method constructor.
*/
@@ -120,14 +122,14 @@
checkNotUsed();
this.lockToken = lockToken;
}
-
-
+
+
// --------------------------------------------------- WebdavMethod Methods
-
- public String getName() {
- return "UNLOCK";
- }
-
+
+ public String getName() {
+ return "UNLOCK";
+ }
+
/**
* Set header. handle the special case of lock-token.
*
@@ -145,7 +147,7 @@
-
+
/**
* Generate additional headers needed by the request.
*
@@ -154,9 +156,9 @@
*/
public void addRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
-
+
super.addRequestHeaders(state, conn);
-
+
super.setRequestHeader("Lock-Token", "<" + lockToken + ">");
}
@@ -167,6 +169,36 @@
((WebdavState) state).removeLock(getPath(), lockToken);
}
}
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ */
+ public void setPath(String path ) {
+ setPath(path, null);
+ }
+
+
+ /**
+ * Set the path part of my request.
+ * It is responsibility of the caller to ensure that the path is
+ * properly encoded (URL safe).
+ *
+ * @param path the path to request. The path is expected
+ * to be NOT URL-encoded
+ * @param enc the encoding used to encode the path. UTF-8 is the default.
+ */
+ public void setPath(String path, String enc ) {
+ if (enc == null) enc = "UTF-8";
+ super.setPath(URLUtil.URLEncode(path, enc));
+ }
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]