luetzkendorf 2005/02/21 08:33:03
Modified: webdavclient/ant/src/java/org/apache/webdav/ant
CollectionScanner.java Utils.java
webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs
Copy.java Delete.java Proppatch.java
Log:
improved handling of spaces and non ascii signs in urls
Revision Changes Path
1.7 +7 -4
jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/CollectionScanner.java
Index: CollectionScanner.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/CollectionScanner.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CollectionScanner.java 30 Dec 2004 15:39:45 -0000 1.6
+++ CollectionScanner.java 21 Feb 2005 16:33:03 -0000 1.7
@@ -102,11 +102,14 @@
}
// get a list of all resources from the given URL
- PropFindMethod propFind = new PropFindMethod(collURL.getURI(),
+ PropFindMethod propFind = new PropFindMethod(collURL.getEscapedURI(),
DepthSupport.DEPTH_1,
PropFindMethod.BY_NAME);
propFind.setPropertyNames(propertyNames.elements());
propFind.setFollowRedirects(true);
+ propFind.setAssertHrefsArePathes(true);
+ propFind.setDecodeResponseHrefs("UTF-8");
+
try {
this.client.executeMethod(propFind);
}
1.10 +17 -12
jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Utils.java
Index: Utils.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Utils.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Utils.java 24 Aug 2004 16:11:15 -0000 1.9
+++ Utils.java 21 Feb 2005 16:33:03 -0000 1.10
@@ -128,7 +128,7 @@
public static boolean resourceExists(HttpClient client, HttpURL httpURL)
throws IOException, HttpException
{
- HeadMethod head = new HeadMethod(httpURL.getURI());
+ HeadMethod head = new HeadMethod(httpURL.getEscapedURI());
head.setFollowRedirects(true);
int status = client.executeMethod(head);
@@ -150,10 +150,13 @@
{
Vector props = new Vector(1);
props.add(RESOURCETYPE);
- PropFindMethod propFind = new PropFindMethod(httpURL.getURI(),
+ PropFindMethod propFind = new PropFindMethod(httpURL.getEscapedURI(),
0,
PropFindMethod.BY_NAME);
propFind.setFollowRedirects(true);
propFind.setPropertyNames(props.elements());
+ propFind.setAssertHrefsArePathes(true);
+ propFind.setDecodeResponseHrefs("UTF-8");
+
int status = client.executeMethod(propFind);
switch (status) {
case WebdavStatus.SC_MULTI_STATUS:
@@ -178,9 +181,11 @@
{
Vector props = new Vector(1);
props.add(GETLASTMODIFIED);
- PropFindMethod propFind = new PropFindMethod(url.getURI(), 0);
+ PropFindMethod propFind = new PropFindMethod(url.getEscapedURI(), 0);
propFind.setPropertyNames(props.elements());
propFind.setFollowRedirects(true);
+ propFind.setAssertHrefsArePathes(true);
+ propFind.setDecodeResponseHrefs("UTF-8");
int status = client.executeMethod(propFind);
switch (status) {
@@ -238,7 +243,7 @@
boolean created = !toBeCreated.empty();
while(!toBeCreated.empty()) {
HttpURL newColl = Utils.createHttpURL(httpURL,
(String)toBeCreated.pop());
- MkcolMethod mkcol = new MkcolMethod(newColl.getURI());
+ MkcolMethod mkcol = new MkcolMethod(newColl.getEscapedURI());
mkcol.setFollowRedirects(true);
generateIfHeader(mkcol, lockToken);
int status = client.executeMethod(mkcol);
@@ -260,7 +265,7 @@
String lockToken)
throws IOException, HttpException
{
- PutMethod put = new PutMethod(url.getURI());
+ PutMethod put = new PutMethod(url.getEscapedURI());
generateIfHeader(put, lockToken);
put.setRequestHeader("Content-Type", contentType);
put.setRequestBody(is);
@@ -311,7 +316,7 @@
String ownerInfo, int depth, int
timeout)
throws IOException, HttpException
{
- LockMethod lock = new LockMethod(url.getURI());
+ LockMethod lock = new LockMethod(url.getEscapedURI());
lock.setDepth(depth);
lock.setTimeout(timeout);
lock.setOwner(ownerInfo);
@@ -341,7 +346,7 @@
String lockToken)
throws IOException, HttpException
{
- UnlockMethod unlock = new UnlockMethod(url.getURI(), lockToken);
+ UnlockMethod unlock = new UnlockMethod(url.getEscapedURI(), lockToken);
unlock.setFollowRedirects(true);
int status = client.executeMethod(unlock);
@@ -363,7 +368,7 @@
throws IOException, HttpException
{
CopyMethod copy = new CopyMethod(
- url.getURI(),
+ url.getEscapedURI(),
destination,
overwrite,
depth);
@@ -387,7 +392,7 @@
String destination, boolean overwrite)
throws IOException, HttpException
{
- MoveMethod move = new MoveMethod(url.getURI(), destination, overwrite);
+ MoveMethod move = new MoveMethod(url.getEscapedURI(), destination,
overwrite);
move.setFollowRedirects(true);
int status = client.executeMethod(move);
switch (status) {
1.4 +4 -4
jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Copy.java 20 Aug 2004 10:53:22 -0000 1.3
+++ Copy.java 21 Feb 2005 16:33:03 -0000 1.4
@@ -52,7 +52,7 @@
Utils.copyResource(
getHttpClient(),
getUrl(),
- this.destinationURL.getURI(),
+ this.destinationURL.getEscapedURI(),
this.depth,
this.overwrite
);
1.8 +4 -5
jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java
Index: Delete.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Delete.java 24 Aug 2004 16:11:15 -0000 1.7
+++ Delete.java 21 Feb 2005 16:33:03 -0000 1.8
@@ -49,7 +49,6 @@
try {
if (!getFileSets().hasNext()) {
// delete the resource given by url
- log("Deleting: " + getUrl(), Project.MSG_INFO);
delete(getUrl(), getUrl().getURI());
} else {
// delete all resources in file sets
@@ -80,7 +79,7 @@
{
validate();
log("Deleting " + logName, ifVerbose());
- DeleteMethod delete = new DeleteMethod(url.getURI());
+ DeleteMethod delete = new DeleteMethod(url.getEscapedURI());
delete.setFollowRedirects(true);
if (this.locktoken != null) {
Utils.generateIfHeader(delete, this.locktoken);
1.6 +4 -4
jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java
Index: Proppatch.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Proppatch.java 20 Aug 2004 10:53:22 -0000 1.5
+++ Proppatch.java 21 Feb 2005 16:33:03 -0000 1.6
@@ -99,7 +99,7 @@
throws IOException, HttpException
{
log(logName, ifVerbose());
- PropPatchMethod propPatch = new PropPatchMethod(url.getURI());
+ PropPatchMethod propPatch = new PropPatchMethod(url.getEscapedURI());
if (this.locktoken != null) {
Utils.generateIfHeader(propPatch, this.locktoken);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]