9 messages in org.apache.jakarta.slide-devProxy support in WebDAV client and patch
FromSent OnAttachments
Ingo Brunberg17 Feb 2003 05:29 
Remy Maucherat17 Feb 2003 05:49 
Remy Maucherat17 Feb 2003 06:24 
Ingo Brunberg17 Feb 2003 07:23 
Michael Smith18 Feb 2003 16:24 
Remy Maucherat19 Feb 2003 00:57 
Lolo19 Feb 2003 01:03 
Pill, Juergen19 Feb 2003 06:37 
Michael Wechner19 Feb 2003 16:59 
Subject:Proxy support in WebDAV client and patch
From:Ingo Brunberg (ib@fiz-chemie.de)
Date:02/17/2003 05:29:45 AM
List:org.apache.jakarta.slide-dev

Hi Slide developers,

although most contributions to Slide seem to be ignored, I am now trying it again. I hope there is still at least one active commiter who is interested in the client side.

Here are patches for WebdavResource.java and WebdavSession.java which address the following issues:

- Modify WebdavSession.java to allow for proxied https. - Add some constructors to WebdavResource.java to make using a proxy easier. Of course one could add even more constructors. - Do not do a refresh() on a WebdavResource after its target has been deleted. - Fix HttpURL for a WebdavResource after applying the MoveMethod before calling refresh(). - Add an additional labelMethod, which takes a destination path as a parameter.

This is a compilation of issues that came up on the developer and the user list in the past weeks. Note that these changes are minimal and I have tested them and they work.

An important thing still missing from these patches is the wrong charset encoding used by most of the WebDAV methods. Rob Owen has described those problems and sent patches to this list, too. Please pay more attention to these kind of posts!!!

Thanks, Ingo

Index: src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java =================================================================== RCS file:
/home/cvspublic/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v retrieving revision 1.55 diff -u -r1.55 WebdavResource.java --- src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java 7 Feb 2003
14:58:57 -0000 1.55 +++ src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java 17 Feb 2003
12:50:09 -0000 @@ -293,6 +293,24 @@

/** * The constructor. + * + * @param httpURL The specified http URL. + * @param proxyHost The hostname of the proxy to use. + * @param proxyPort The port number of the proxy to use. + * @exception HttpException + * @exception IOException + * @see #setDefaultAction(int) + */ + public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort) + throws HttpException, IOException { + + setProxy(proxyHost, proxyPort); + setHttpURL(httpURL); + } + + + /** + * The constructor. * It must be put an escaped http URL as an arguement. * * @param escapedHttpURL The escaped http URL string. @@ -309,6 +327,25 @@

/** * The constructor. + * It must be put an escaped http URL as an arguement. + * + * @param escapedHttpURL The escaped http URL string. + * @param proxyHost The hostname of the proxy to use. + * @param proxyPort The port number of the proxy to use. + * @exception HttpException + * @exception IOException + * @see #setDefaultAction(int) + */ + public WebdavResource(String escapedHttpURL, String proxyHost, + int proxyPort) throws HttpException, IOException { + + setProxy(proxyHost, proxyPort); + setHttpURL(escapedHttpURL); + } + + + /** + * The constructor. * * @param httpURL The http URL. * @param additionalPath The added relative path. @@ -2613,6 +2650,15 @@ public boolean labelMethod(String labelname, int type) throws HttpException, IOException { + return labelMethod(httpURL.getPath(), labelname, type); + } + + /** + * Execute a LABEL method on the given path, setting the given label + */ + public boolean labelMethod(String path, String labelname, int type) + throws HttpException, IOException + { int labeltype=0;

switch(type) { @@ -2628,8 +2674,7 @@ }

setClient(); - LabelMethod method = new LabelMethod(httpURL.getPath(), labeltype, - labelname); + LabelMethod method = new LabelMethod(path, labeltype, labelname);

int statusCode = client.executeMethod(method);

@@ -3389,7 +3434,6 @@ throws HttpException, IOException {

boolean result = deleteMethod(httpURL.getPath()); - if (result) refresh();

return result; } @@ -3427,9 +3471,12 @@ public boolean moveMethod(String destination) throws HttpException, IOException {

- boolean result = moveMethod(httpURL.getPath(), - HttpURL.getPath(destination)); - if (result) refresh(); + String destinationPath = HttpURL.getPath(destination); + boolean result = moveMethod(httpURL.getPath(), destinationPath); + if (result) { + httpURL.setPath(destinationPath); + refresh(); + }

return result; }

Index: src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java =================================================================== RCS file:
/home/cvspublic/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java,v retrieving revision 1.25 diff -u -r1.25 WebdavSession.java --- src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java 16 Dec 2002
15:17:29 -0000 1.25 +++ src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java 17 Feb 2003
12:50:38 -0000 @@ -185,7 +185,8 @@ client.setState(new WebdavState()); if(proxyHost != null && proxyPort > 0) client.startSession(httpURL.getHost(), httpURL.getPort(), - proxyHost, proxyPort); + proxyHost, proxyPort, + httpURL.getEscapedHttpURL().startsWith("https")); else client.startSession(httpURL.getHost(), httpURL.getPort(), httpURL.getEscapedHttpURL().startsWith("https"));