Hi

I am executing a webdav propfind method as follows:

PropFindMethod propFindMethod = new PropFindMethod("
http://localhost:8080/content/slingdemo/abc.txt";);
httpClient.executeMethod(propFindMethod );

The method gets executed successfully as indicated by:

propFindMethod.getStatusCode() = 207

which indicates a Multi-Status response.

Now I want to parse the response body. I tried the following:

propFindMethod.getResponseBody() // Returns null
propFindMethod.getResponseBodyAsDocument() //Again returns null
propFindMethod.getResponseBodyAsString() // Return null

All the above return null. So I tried:

propFindMethod.getResponseBodyAsMultiStatus() which returns a multi-status
response.
Using this multi-status response, I try to get a DavProperty from the
response as follows:

DavProperty davProperty = (DavProperty<LockDiscovery>)
propFindMethod.getResponseBodyAsMultiStatus().getResponses()[0].getProperties(200).get(
                DavPropertyName.LOCKDISCOVERY);
LockDiscovery lockDiscovery = davProperty.getValue();

But this results in the below exception:

java.lang.ClassCastException: org.apache.xerces.dom.DeferredElementNSImpl
cannot be cast to org.apache.jackrabbit.webdav.lock.LockDiscovery

As per the docs at [1], davProperty.getValue() must return a LockDiscovery
object but it is returning DeferredElementNSImpl  instead. Any idea how to
get this working? Is this the right approach? If not, please suggest the
right one.

Regards
Satya Deep

[1] -
http://jackrabbit.apache.org/api/2.10/org/apache/jackrabbit/webdav/property/DavProperty.html

Reply via email to