The "normal" way of creating a new Resource would be to first create a
WebdavResource of an existing URL, usually the top-level resource, and
then call resource.putMethod("newPath", "this is my data").
Anyway, throwing an exception doesn't seem quite right. I guess this
change was introduced to inform the user that something went wrong. In
contrast to most of the methods in WebdavResource, propfindMethod()
returns an Enumeration instead of a boolean. This means the old
behavior gives you an empty Enumeration, so it doesn't become apparent
that the resource does not exist.
The more I deliberate about this, the more I tend to revert the
change, because you can always query the status code of the
WebdavResource.
What do others think about this?
Regards,
Ingo
> I've been using the client library for Slide 1.0.16 for several months.
> I've decided to attempt to move to the top of the development tree in
> order to pick up a bunch of bug fixes, and am having a problem creating
> a reference to a non-existent file.
>
> In the past, in order to create a new file, I did:
>
> WebdavResource r = new WebdavResource(url) // where the url refers to a
> non existent file in an existing and writable directory
>
> r.putMethod("this is my data")
>
> This worked fine in 1.0.16, but using the top of the tree, I get an
> exception which I'm including at the bottom of the email. The exception
> occurs when I construct the WebdavResource.
> (note that I'm actually invoking this from within jython).
>
> My Dav Server is a 2.0.45 Apache with dav support compiled in.
> It's worked just fine with the 1.0.16. release.
>
> Looking through the source, there is a change to the propfindMethod
> in WebdavResource.java (revision 1.54). It's now looking for a
> multistatus reply from the
> server and throwing an exception if the reply wasn't a multistatus.
> Using tcpmon, I can see that the response is, in fact, just a
> 404 not found. But the old code was ok with this.
>
> I'm a more than a little perplexed, since I imagine that I can't
> be the only one who would run into this.
>
> If anyone shed any light on this, I'd be very grateful.
>
> Rob Bjornson
>
>
>
> ==============
> Listen Port: 6999
> Target Host: 127.0.0.1
> Target Port: 24162
> ==== Request ====
> PROPFIND /datarepository/test/newfile HTTP/1.1
> Content-Length: 207
> Content-Type: text/xml; charset=utf-8
> Host: 127.0.0.1
> Depth: 0
> User-Agent: Jakarta HTTP Client/1.0
>
> <?xml version="1.0" encoding="utf-8" ?><D:propfind
> xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>====
>
> Response ====
> HTTP/1.1 404 Not Found
> Date: Thu, 11 Dec 2003 15:05:45 GMT
> Server: Apache/2.0.45 (Unix) DAV/2
> Content-Length: 306
> Content-Type: text/html; charset=iso-8859-1
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>404 Not Found</title>
> </head><body>
> <h1>Not Found</h1>
> <p>The requested URL /datarepository/test/newfile was not found on this
> server.</p>
> <hr />
> <address>Apache/2.0.45 (Unix) DAV/2 Server at 127.0.0.1 Port 80</address>
> </body></html>
>
> ==============
>
>
> org.apache.commons.httpclient.HttpException
> at
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3150)
> at
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3112)
> at
> org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:881)
> at
> org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.java:826)
> at
> org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1715)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1153)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1172)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1251)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1269)
> at
> org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:349)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
> at
> org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java)
> at org.python.core.PyJavaInstance.__init__(PyJavaInstance.java)
> at org.python.core.PyJavaClass.__call__(PyJavaClass.java)
> at org.python.core.PyObject.__call__(PyObject.java)
> at org.python.pycode._pyx0.f$0(bug.py:3)
> at org.python.pycode._pyx0.call_function(bug.py)
> at org.python.core.PyTableCode.call(PyTableCode.java)
> at org.python.core.PyCode.call(PyCode.java)
> at org.python.core.Py.runCode(Py.java)
> at org.python.core.__builtin__.execfile_flags(__builtin__.java)
> at
> org.python.util.PythonInterpreter.execfile(PythonInterpreter.java)
> at org.python.util.jython.main(jython.java)
>
> org.apache.commons.httpclient.HttpException:
> org.apache.commons.httpclient.HttpException
> >>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]