org.apache.webdav.lib.methods
Class PropFindMethod

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

public class PropFindMethod
extends XMLResponseMethodBase
implements DepthSupport

This class implements the WebDAV PROPFIND Method.

The PROPFIND method retrieves properties defined on the resource identified by the Request-URI, if the resource does not have any internal members, or on the resource identified by the Request-URI and potentially its member resources, if the resource is a collection that has internal member URIs.

A typical request looks like this:


 PROPFIND /file HTTP/1.1
 Host: www.foo.bar
 Content-type: text/xml; charset="utf-8"
 Content-Length: xxxx

 <?xml version="1.0" encoding="utf-8" ?>
   <D:propfind xmlns:D="DAV:">
   <D:prop xmlns:R="http://www.foo.bar/boxschema/">
     <R:bigbox/>
     <R:author/>
     <R:DingALing/>
     <R:Random/>
   </D:prop>
 </D:propfind>
 

Author:
Remy Maucherat, B.C. Holmes, Dirk Verbeeck

Inner classes inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
XMLResponseMethodBase.Response, XMLResponseMethodBase.ResponseWithinMultistatus, XMLResponseMethodBase.SingleResponse
 
Field Summary
static int ALL
          Request of all properties name and value.
static int BY_NAME
          Request of named properties.
protected  int depth
          Depth.
static int NAMES
          Request of all properties name.
protected  java.lang.String prefix
          The namespace abbreviation that prefixes DAV tags
protected  PropertyName[] propertyNames
          Property name list.
protected  int type
          Type of the Propfind.
 
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.webdav.lib.methods.DepthSupport
DEPTH_0, DEPTH_1, DEPTH_INFINITY
 
Fields inherited from interface org.apache.commons.httpclient.HttpMethod
PROTOCOL
 
Constructor Summary
PropFindMethod()
          Method constructor.
PropFindMethod(java.lang.String path)
          Method constructor.
PropFindMethod(java.lang.String path, java.util.Enumeration propertyNames)
          Method constructor.
PropFindMethod(java.lang.String path, int depth)
          Method constructor.
PropFindMethod(java.lang.String path, int depth, java.util.Enumeration propertyNames)
          Method constructor.
PropFindMethod(java.lang.String path, int depth, int type)
          Method constructor.
 
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()
          Generate the query body.
 java.util.Enumeration getAllResponseURLs()
          This method returns an enumeration of URL paths.
 int getDepth()
          Depth getter.
 java.util.Enumeration getResponseProperties(java.lang.String urlPath)
          Returns an enumeration of Property objects.
 int getType()
          Type getter.
 void recycle()
          Reset the State of the class to its initial state, so that it can be used again.
 void setDepth(int depth)
          Depth setter.
 void setHeader(java.lang.String headerName, java.lang.String headerValue)
          Set header.
 void setPropertyNames(java.util.Enumeration propertyNames)
          Property names setter.
 void setType(int type)
          Type setter.
 
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, 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

BY_NAME

public static final int BY_NAME
Request of named properties.

ALL

public static final int ALL
Request of all properties name and value.

NAMES

public static final int NAMES
Request of all properties name.

type

protected int type
Type of the Propfind.

propertyNames

protected PropertyName[] propertyNames
Property name list.

depth

protected int depth
Depth.

prefix

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

PropFindMethod

public PropFindMethod()
Method constructor.

PropFindMethod

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

PropFindMethod

public PropFindMethod(java.lang.String path,
                      int depth)
Method constructor.

PropFindMethod

public PropFindMethod(java.lang.String path,
                      int depth,
                      int type)
Method constructor.

PropFindMethod

public PropFindMethod(java.lang.String path,
                      java.util.Enumeration propertyNames)
Method constructor.

PropFindMethod

public PropFindMethod(java.lang.String path,
                      int depth,
                      java.util.Enumeration propertyNames)
Method constructor.
Method Detail

setHeader

public void setHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Set header. handle the special case of Depth.
Overrides:
setHeader in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
headerName - Header name
headerValue - Header value

setType

public void setType(int type)
Type setter.
Parameters:
type - New type value

getType

public int getType()
Type getter.
Returns:
int type value

setDepth

public void setDepth(int depth)
Depth setter.
Specified by:
setDepth in interface DepthSupport
Parameters:
depth - New depth value

getDepth

public int getDepth()
Depth getter.
Specified by:
getDepth in interface DepthSupport
Returns:
int depth value

setPropertyNames

public void setPropertyNames(java.util.Enumeration propertyNames)
Property names setter. The enumeration may contain strings with or without a namespace prefix but the preferred way is to provide PropertyName objects.
Parameters:
propertyNames - List of the property names

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()
Generate the query body.
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.