You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Satya Deep Maheshwari <co...@gmail.com> on 2015/10/08 11:51:29 UTC

[webdav]Getting propfind method response

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

Re: [webdav]Getting propfind method response

Posted by Satya Deep Maheshwari <co...@gmail.com>.
Anybody got a chance to look into this?

On Thu, Oct 8, 2015 at 3:21 PM, Satya Deep Maheshwari <co...@gmail.com>
wrote:

> 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
>
>
>