You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Angela Schreiber <an...@day.com> on 2006/12/01 10:31:10 UTC
Re: Webdav SearchMethod and xpath query
hi darren
there exists a example in the SPI contribution, that
uses the search-functionality exposed by the SearchResourceImpl
in o.a.j.webdav.jcr.SearchResourceImpl.java (thus the jcr
remoting server implementation). and this one works for SQL
and XPath queries.
do you have your own implementation of the SearchResource?
and: are you sure, your implementation understands that
{http://www.day.com/jcr/webdav/1.0}xpath
must be converted to the javax.jcr.query.Query.XPATH constant,
in order to be able to build a valid Query object?
regards
angela
below some conversation fragments from my test (which i performed
on my current checkout from trunk and not on the 1.1 branch. but
the code doesn't differ in the relevant parts.
Request -------------------------------------------------------------
OPTIONS /jackrabbit/server/default HTTP/1.1
Host: localhost:5502
Response -------------------------------------------------------------
HTTP/1.0 200 OK
Content-Length: 0
DASL: <xpath>
DASL: <sql>
Allow: OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, MKCOL,
COPY, PUT, DELETE, MOVE, LOCK, UNLOCK, REPORT, MKWORKSPACE, SEARCH, UPDATE
DAV:
1,2,version-control,version-history,checkout-in-place,label,merge,update,workspace
Request -------------------------------------------------------------
SEARCH /jackrabbit/server/default HTTP/1.1 ]
Host: localhost:5502 ]
Content-Length: 126 ]
Content-Type: text/xml; charset=UTF-8 ]
<?xml version="1.0" encoding="UTF-8"?>]
<D:searchrequest xmlns:D="DAV:"><xpath>//element(*,
rep:root)</xpath></D:searchrequest>
Response -------------------------------------------------------------
HTTP/1.0 207 Code 207
Content-Type: text/xml; charset=utf-8
Content-Length: 748
<?xml version="1.0" encoding="UTF-8"?><D:multistatus
xmlns:D="DAV:"><D:response><D:href>http://localhost:5502/jackrabbit/server/default/jcr%3aroot/</D:href><D:propstat><D:prop><dcr:search-result-property
xmlns:dcr="http://www.day.com/jcr/webdav/1.0"><dcr:column><dcr:name>jcr:primaryType</dcr:name><dcr:value
dcr:type="Name">rep:root</dcr:value></dcr:column><dcr:column><dcr:name>jcr:path</dcr:name><dcr:value
dcr:type="Path">/</dcr:value></dcr:column><dcr:column><dcr:name>jcr:score</dcr:name><dcr:value
dcr:type="Long">1000</dcr:value></dcr:column></dcr:search-result-property></D:prop><D:status>HTTP/1.1
200
OK</D:status></D:propstat></D:response><D:responsedescription>jcr:primaryType
jcr:path jcr:score</D:responsedescription></D:multistatus>
Darren Hartford wrote:
> I'm trying to use the xpath query mechanism through webdav.
>
> ========
> String jackrabbitquery=
> "<d:searchrequest xmlns:d=\"DAV\"
> dcr:=\"http://www.day.com/jcr/webdav/1.0\">" +
> "<dcr:xpath>//sv:node[@sv:name='jcr:root']</dcr:xpath>" +
> "</d:searchrequest>";
> ....
> String mypath = "/jackrabbit-server-1.1/server/default/";
> HttpURL url = new HttpURL("http://localhost:8080" + mypath);
> ...
> SearchMethod smethod = new SearchMethod(mypath,jackrabbitquery,"xpath");
> ...
> =======
>
> And I'm always getting 400 responses and various errors like:
>
> ==========
> <D:error xmlns:D="DAV:"><dcr:exception
> xmlns:dcr="http://www.day.com/jcr/webdav/1.0"><dcr:class>javax.jcr.query
> .InvalidQueryException</dcr:class><dcr:message>Encountered "<EOF>"
> at line 1, column 163.
> Was expecting one of:
> ....
>
> And
> <D:error xmlns:D="DAV:"><dcr:exception
> xmlns:dcr="http://www.day.com/jcr/webdav/1.0"><dcr:class>javax.jcr.query
> .InvalidQueryException</dcr:class><dcr:message>Lexical error at line 1,
> column 45. Encountered: ":" (58), after : "": Lexical error at line 1,
> column 45. Encountered: ":" (58), after :
> ""</dcr:message></dcr:exception></D:error>
> ========
>
> Could someone point me to some example or test code or some similar
> sample that would be a reference working example? Using the
> org.apache.jackrabbit.webdav.client.methods.SearchMethod from jackrabbit
> 1.1.
>
> Thanks,
> -D