Hi Martin,

this is a known problem, that was discussed not too long before.
The href that a WebDAV server returns has to be escaped according to
the specs, so there's nothing wrong with that.
The real problem is the HttpURL class that is part of Slide. It has
some "broken" constructors that do not correctly escape the given
path. I you want to be sure, use the constructor that takes a ready to
use escaped URL.

I didn't want to fix it because I'd rather switch to using the HttpURL
class from Commons Httpclient, which I think is "bug free". The
problem is that this requires an API change, but it has to be done
anyway, because Slide client is effectively a companion to Commons
Httpclient.

Ingo

> I noticed a bug in the client lib when requesting childs for resources that
> have escaped characters in the path. In this situation the collection
> resource is also returned as a child.
> 
> The reason is that the href of the response is compared with the escaped
> path of the collection resource. Because of this the collection is not
> identified in the response.
> 
> In the appended patch this is fixed by escaping the href too before the
> compare. I do the escape by creating a temporary HttpURL object. Does anyone
> know another way to escape the path without escaping the slashes in the
> path? HttpURL does this.
> 
> Martin
> 
> ---------------
> Martin Dulisch
> Open Source Group, S&N AG
> [EMAIL PROTECTED]
> 
> ------=_NextPart_000_002E_01C3D908.33F69670
> Content-Type: text/plain;
>       name="patch.txt"
> Content-Disposition: attachment;
>       filename="patch.txt"
> Content-Transfer-Encoding: quoted-printable
> 
> Index: WebdavResource.java
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> retrieving revision 1.1
> diff -u -r1.1 WebdavResource.java
> --- WebdavResource.java       9 Jan 2004 09:56:04 -0000       1.1
> +++ WebdavResource.java       12 Jan 2004 11:22:11 -0000
> @@ -1,7 +1,7 @@
>  /*
> - * $Header: /home/cvspublic/jakarta-slide/webdavclient/clientlib/src/java/=
> org/apache/webdav/lib/WebdavResource.java,v 1.1 2004/01/09 09:56:04 ib Exp $
> - * $Revision: 1.1 $
> - * $Date: 2004/01/09 09:56:04 $
> + * $Header: /home/cvspublic/jakarta-slide/src/webdav/client/src/org/apache=
> /webdav/lib/WebdavResource.java,v 1.69 2003/09/25 12:45:27 ib Exp $
> + * $Revision: 1.69 $
> + * $Date: 2003/09/25 12:45:27 $
>   *
>   * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>   *
> @@ -911,15 +911,15 @@
> =20
>          // Make the resources in the collection empty.
>          childResources.removeAll();
> +        HttpURL workingUrl =3D new HttpURL(httpURL.getHost(), httpURL.getP=
> ort(), "/");
>          while (responses.hasMoreElements()) {
> =20
>              ResponseEntity response =3D
>                  (ResponseEntity) responses.nextElement();
> =20
>              boolean itself =3D false;
> -            String href =3D response.getHref();
> -            if (!href.startsWith("/"))
> -                href =3D HttpURL.getEscapedPath(href);
> +            workingUrl.setPath(response.getHref());
> +            String href =3D workingUrl.getEscapedPath();
>              String httpURLPath =3D httpURL.getEscapedPath();
>              int compared =3D httpURLPath.compareTo(href);
>              // Compare with the href path and requested-path itself.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to