org.apache.webdav.lib.methods

Class ReportMethod

Implemented Interfaces:
DepthSupport

public class ReportMethod
extends XMLResponseMethodBase
implements DepthSupport

This class implements the WebDAV REPORT Method.

The REPORT 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:

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase

XMLResponseMethodBase.OptionsResponse, XMLResponseMethodBase.Response, XMLResponseMethodBase.ResponseWithinMultistatus, XMLResponseMethodBase.SingleResponse

Field Summary

static int
ALL
Request of all properties name and value.
static int
LOCATE_HISTORY
static int
SUB_SET
Request specified properties.
protected int
depth
Depth.
protected String
prefix
The namespace abbreviation that prefixes DAV tags
protected PropertyName[]
propertyNames
Property name list.
String
sVersionHistory
protected int
type
Type of the Propfind.

Fields inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase

builder, decodeResponseHrefs, responseURLs

Fields inherited from interface org.apache.webdav.lib.methods.DepthSupport

DEPTH_0, DEPTH_1, DEPTH_INFINITY

Constructor Summary

ReportMethod()
Method constructor.
ReportMethod(String path)
Method constructor.
ReportMethod(String path, Enumeration propertyNames)
Method constructor.
ReportMethod(String path, int depth)
Method constructor.
ReportMethod(String path, int depth, Enumeration propertyNames)
Method constructor.
ReportMethod(String path, int depth, Enumeration propertyNames, Enumeration histUrl)
Method constructor.
ReportMethod(String path, int depth, String sBody)

Method Summary

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.
int
getDepth()
Depth getter.
String
getName()
Enumeration
getResponseProperties(String urlPath)
Returns an enumeration of Property objects.
int
getType()
Type getter.
void
recycle()
void
setDepth(int depth)
Depth setter.
void
setHistoryURLs(Enumeration historyURLs)
sets History URL for locate by history Report
void
setPropertyNames(Enumeration propertyNames)
Property names setter.
void
setRequestHeader(String headerName, String headerValue)
Set a header value, redirecting attempts to set the "Depth" header to a setDepth(int) call.
void
setType(int type)
Type setter.

Methods inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase

convertElementToProperty, generateRequestBody, getDebug, getRequestContentLength, getResponseDocument, getResponseHashtable, getResponseURLs, getResponses, parseResponse, parseXMLResponse, readResponseBody, recycle, setDebug, setDecodeResponseHrefs, setDocument, setResponseHashtable, writeRequestBody

Methods inherited from class org.apache.webdav.lib.methods.HttpRequestBodyMethodBase

getRequestContentLength, isRequestContentAlreadySet, readContinueCode, recycle, setRequestBody, setRequestBody, setRequestBody, setRequestBody, setRequestBody, writeRequestBody

Field Details

ALL

public static final int ALL
Request of all properties name and value.
Field Value:
1

LOCATE_HISTORY

public static final int LOCATE_HISTORY
Field Value:
2

SUB_SET

public static final int SUB_SET
Request specified properties.
Field Value:
0

depth

protected int depth
Depth.

prefix

protected String prefix
The namespace abbreviation that prefixes DAV tags

propertyNames

protected PropertyName[] propertyNames
Property name list.

sVersionHistory

public String sVersionHistory

type

protected int type
Type of the Propfind.

Constructor Details

ReportMethod

public ReportMethod()
Method constructor.

ReportMethod

public ReportMethod(String path)
Method constructor.

ReportMethod

public ReportMethod(String path,
                    Enumeration propertyNames)
Method constructor.

ReportMethod

public ReportMethod(String path,
                    int depth)
Method constructor.

ReportMethod

public ReportMethod(String path,
                    int depth,
                    Enumeration propertyNames)
Method constructor.

ReportMethod

public ReportMethod(String path,
                    int depth,
                    Enumeration propertyNames,
                    Enumeration histUrl)
Method constructor.

ReportMethod

public ReportMethod(String path,
                    int depth,
                    String sBody)

Method Details

addRequestHeaders

public void addRequestHeaders(HttpState state,
                              HttpConnection conn)
            throws IOException,
                   HttpException
Generate additional headers needed by the request.
Parameters:
state - State token
conn - The connection being used to make the request.

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.

Overrides:
generateRequestBody in interface XMLResponseMethodBase

getAllResponseURLs

public Enumeration getAllResponseURLs()
This method returns an enumeration of URL paths. If the ReportMethod 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

getDepth

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

getName

public String getName()

getResponseProperties

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

getType

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

recycle

public void recycle()
Overrides:
recycle in interface XMLResponseMethodBase

setDepth

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

setHistoryURLs

public void setHistoryURLs(Enumeration historyURLs)
sets History URL for locate by history Report

setPropertyNames

public void setPropertyNames(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

setRequestHeader

public void setRequestHeader(String headerName,
                             String headerValue)
Parameters:
headerName - Header name
headerValue - Header value

setType

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