Hello,

I am hoping someone on the list can help me with a problem that I am
having using the Slide WebDAV clientlib.

I am using the WebdavResource to discover subcollections for a given
URI. In doing this, I call 
WebdavResource[] wdrList = wdr.listWebdavResources();

The problem that I am having is that this operation is failing when the
collection contains a resource whose name contains the '[' and ']'
characters, i.e. "enduser[1].css"

This may be related to ASF Bugzilla #29987

The problem is obviously that the path must be escaped prior to
attempting to create a HttpURL/URI, but who is responsible for doing the
escaping? All of the code responsible for obtaining the resources in the
collection and creating new HttpURL's for those resources is done in the
WebdavResource class.

The WebdavResource.getName(String uri, boolean decode) method appears to
be lacking in a proper verification step to detect characters in the
resource name that must be escaped, and escaping them if required. The
problem is that by freely appending its result to the parent
httpURL.getEscapedURI(), the last portion of this concatenated childURL
possibly contains unescaped characters, and therefore when it attempts
to create a new HttpURL, it may fail.

Here is a portion of the stack trace I am getting:
Caused by: org.apache.commons.httpclient.URIException: escaped absolute
path not valid
at org.apache.commons.httpclient.URI.setRawPath(URI.java:2813)
at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2005)
at org.apache.commons.httpclient.HttpURL.<init>(HttpURL.java:108)
at
org.apache.webdav.lib.WebdavResource.setWebdavProperties(WebdavResource.java:1087)
at
org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:977)
at
org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.java:921)
at
org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1920)
at
org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1943)
at
org.apache.webdav.lib.WebdavResource.getChildResources(WebdavResource.java:2108)
at
org.apache.webdav.lib.WebdavResource.listWebdavResources(WebdavResource.java:2125)


Is it a possibility that the WebDAV server is responsible by not
properly escaping the resource names in the response? I do not think
that this is a requirement of the spec, but I am new to WebDAV.
Here is the response from the WebDAV server:
<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:a="DAV:">
<a:response>
  <a:href>http://xxx.net/shared_drive/project/css/</a:href>
  <a:propstat>
    <a:status>HTTP/1.1 200 OK</a:status>
    <a:prop>
      <a:displayname>css</a:displayname>
      <a:resourcetype><a:collection/></a:resourcetype>
      <a:getcontenttype>application/octet-stream</a:getcontenttype>
      <a:getcontentlength b:dt="int">0</a:getcontentlength>
      <a:getlastmodified b:dt="dateTime.rfc1123">Mon, 10 Apr 2006
19:34:33 GMT</a:getlastmodified>
    </a:prop>
  </a:propstat>
  <a:propstat>
    <a:status>HTTP/1.1 404 Resource Not Found</a:status>
    <a:prop>
      <a:checked-in/>
      <a:checked-out/>
      <a:version-name/>
    </a:prop>
  </a:propstat>
</a:response>

<a:response>

<a:href>http://xxx.net/shared_drive/project/css/enduser[1].css</a:href>
  <a:propstat>
    <a:status>HTTP/1.1 200 OK</a:status>
    <a:prop>
      <a:displayname>enduser[1].css</a:displayname>
      <a:resourcetype/>
      <a:getcontenttype>text/css</a:getcontenttype>
      <a:getcontentlength b:dt="int">5888</a:getcontentlength>
      <a:getlastmodified b:dt="dateTime.rfc1123">Mon, 25 Nov 2002
22:56:22 GMT</a:getlastmodified>
    </a:prop>
  </a:propstat>
  <a:propstat>
    <a:status>HTTP/1.1 404 Resource Not Found</a:status>
    <a:prop>
      <a:checked-in/>
      <a:checked-out/>
      <a:version-name/>
    </a:prop>
  </a:propstat>
</a:response>
</a:multistatus>


Any help would be greatly appreciated. Thanks in advance.

-Brad

Environment: 
Slide Version: jakarta-slide-webdavlib-2.2pre1.jar (From trunk)
HttpClient Version: commons-httpclient-2.0-final.jar
O/S: Linux (Fedora Core 4)
JDK: 1.5.0_06
WebDAV Server: IIS 5.0


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

Reply via email to