org.apache.webdav.lib.methods
Class SearchMethod
public class SearchMethod
This class implements the WebDAV SEARCH Method.
The SEARCH method initiates a server-side search. The body of the
request defines the query. The server responds with a text/xml entity
matching the WebDAV PROPFIND response.
According to
the DASL draft a typical request looks like this:
SEARCH /folder/ HTTP/1.1
Host: www.foo.bar
Content-type: text/xml; charset="utf-8"
Content-Length: xxxx
<?xml version="1.0"?>
<D:searchrequest xmlns:D = "DAV:" >
<D:basicsearch>
<D:select>
<D:prop><D:getcontentlength/></D:prop>
</D:select>
<D:from>
<D:scope>
<D:href>/folder/</D:href>
<D:depth>infinity</D:depth>
</D:scope>
</D:from>
</D:basicsearch>
</D:searchrequest>
However, other query grammars may be used. A typical request using
the
SQL-based grammar implemented in Microsoft's Web Storage System
(currently shipping with Exchange 2000 and SharePoint Portal Server)
looks like this:
SEARCH /folder/ HTTP/1.1
Host: www.foo.bar
Content-type: text/xml; charset="utf-8"
Content-Length: xxxx
<?xml version="1.0"?>
<D:searchrequest xmlns:D = "DAV:" >
<D:sql>
SELECT "DAV:contentclass", "DAV:displayname"
FROM "/folder/"
WHERE "DAV:ishidden" = false
AND "DAV:isfolder" = false
</D:sql>
</D:searchrequest>
protected String | prefix - The namespace abbreviation that prefixes DAV tags
|
void | addRequestHeaders(HttpState state, HttpConnection conn) - Generate additional headers needed by the request.
|
protected String | generateRequestBody() - DAV requests that contain a body must override this function to
generate that body.
|
Enumeration | getAllResponseURLs() - This method returns an enumeration of URL paths.
|
String | getName()
|
Enumeration | getResponseProperties(String urlPath) - Returns an enumeration of
Property objects.
|
void | parseResponse(InputStream input, HttpState state, HttpConnection conn) - Parse response.
|
void | recycle() - Reset the State of the class to its initial state, so that it can be
used again.
|
convertElementToProperty , generateRequestBody , getDebug , getRequestContentLength , getResponseDocument , getResponseHashtable , getResponseURLs , getResponses , parseResponse , parseXMLResponse , readResponseBody , recycle , setDebug , setDecodeResponseHrefs , setDocument , setResponseHashtable , writeRequestBody |
prefix
protected String prefix
The namespace abbreviation that prefixes DAV tags
SearchMethod
public SearchMethod()
Method constructor.
SearchMethod
public SearchMethod(String path)
Method constructor.
SearchMethod
public SearchMethod(String path,
String query)
Construct a SearchMethod using the given XML request body.
path
- Relative path to the WebDAV resource
(presumably a collection).query
- Complete request body in XML including a search query in
your favorite grammar.
addRequestHeaders
public void addRequestHeaders(HttpState state,
HttpConnection conn)
throws IOException,
HttpException
Generate additional headers needed by the request.
state
- State tokenconn
- the connection
generateRequestBody
protected String generateRequestBody()
DAV requests that contain a body must override this function to
generate that body.
The default behavior simply returns an empty body.
- generateRequestBody in interface XMLResponseMethodBase
getAllResponseURLs
public Enumeration getAllResponseURLs()
This method returns an enumeration of URL paths. If the PropFindMethod
was sent to the URL of a collection, then there will be multiple URLs.
The URLs are picked out of the <D:href>
elements
of the response.
- an enumeration of URL paths as Strings
getName
public String getName()
getResponseProperties
public Enumeration getResponseProperties(String urlPath)
Returns an enumeration of Property
objects.
parseResponse
public void parseResponse(InputStream input,
HttpState state,
HttpConnection conn)
throws IOException,
HttpException
Parse response.
- parseResponse in interface XMLResponseMethodBase
recycle
public void recycle()
Reset the State of the class to its initial state, so that it can be
used again.
- recycle in interface XMLResponseMethodBase