org.apache.webdav.lib.methods
Class SearchMethod

java.lang.Object
  |
  +--org.apache.commons.httpclient.HttpMethodBase
        |
        +--org.apache.webdav.lib.methods.XMLResponseMethodBase
              |
              +--org.apache.webdav.lib.methods.SearchMethod
All Implemented Interfaces:
org.apache.commons.httpclient.HttpMethod

public class SearchMethod
extends XMLResponseMethodBase

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

 
 
 
   
     
   
   
     
       /folder/
       infinity
     
   
 
 
 

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

 
 
   
   SELECT "DAV:contentclass", "DAV:displayname"
     FROM "/folder/"
    WHERE "DAV:ishidden" = false
      AND "DAV:isfolder" = false
   
 
 

Author:
Shawn C. Dodd

Inner classes inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
XMLResponseMethodBase.Response, XMLResponseMethodBase.ResponseWithinMultistatus, XMLResponseMethodBase.SingleResponse
 
Field Summary
protected  java.lang.String prefix
          The namespace abbreviation that prefixes DAV tags
 
Fields inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
builder
 
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase
debug, followRedirects, name, parameters, path, query, queryString, requestHeaders, responseHeaders, state, statusCode, statusText
 
Fields inherited from interface org.apache.commons.httpclient.HttpMethod
PROTOCOL
 
Constructor Summary
SearchMethod()
          Method constructor.
SearchMethod(java.lang.String path)
          Method constructor.
SearchMethod(java.lang.String path, java.lang.String query)
          Construct a SearchMethod using the given XML request body.
 
Method Summary
 void generateHeaders(java.lang.String host, org.apache.commons.httpclient.State state)
          Generate additional headers needed by the request.
 java.lang.String generateQuery()
          Return the query supplied in the constructor or setQuery().
 java.util.Enumeration getAllResponseURLs()
          This method returns an enumeration of URL paths.
 java.util.Enumeration getResponseProperties(java.lang.String urlPath)
          Returns an enumeration of Property objects.
 void recycle()
          Reset the State of the class to its initial state, so that it can be used again.
 
Methods inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
convertElementToProperty, getResponseDocument, getResponseHashtable, getResponses, getState, parseResponse, parseXMLResponse
 
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
checkNotUsed, checkUsed, followRedirects, generateHeaders, generateRequestLine, generateRequestLine, getHeader, getHeaders, getHeadersHashtable, getName, getPath, getStatusCode, getStatusText, hasBeenUsed, hasResponseBody, isStreamedQuery, needContentLength, needExpectation, processResponseHeaders, removeHeader, setDebug, setFollowRedirects, setHeader, setParameter, setPath, setQuery, setQueryString, setState, setStatusCode, setStatusText, setUsed, streamQuery, validate
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

protected java.lang.String prefix
The namespace abbreviation that prefixes DAV tags
Constructor Detail

SearchMethod

public SearchMethod()
Method constructor.

SearchMethod

public SearchMethod(java.lang.String path)
Method constructor.

SearchMethod

public SearchMethod(java.lang.String path,
                    java.lang.String query)
Construct a SearchMethod using the given XML request body.
Parameters:
path - Relative path to the WebDAV resource (presumably a collection).
query - Complete request body in XML including a search query in your favorite grammar.
Method Detail

recycle

public void recycle()
Description copied from class: XMLResponseMethodBase
Reset the State of the class to its initial state, so that it can be used again.
Overrides:
recycle in class XMLResponseMethodBase

generateHeaders

public void generateHeaders(java.lang.String host,
                            org.apache.commons.httpclient.State state)
Generate additional headers needed by the request.
Overrides:
generateHeaders in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
host - the host
state - State token

generateQuery

public java.lang.String generateQuery()
Return the query supplied in the constructor or setQuery(). In future, this will construct a query in the grammar you're interested in.
Overrides:
generateQuery in class org.apache.commons.httpclient.HttpMethodBase
Returns:
String query

getAllResponseURLs

public java.util.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.
Returns:
an enumeration of URL paths as Strings

getResponseProperties

public java.util.Enumeration getResponseProperties(java.lang.String urlPath)
Returns an enumeration of Property objects.