Package org.apache.webdav.lib.methods
Class PropFindMethod
java.lang.Object
org.apache.commons.httpclient.HttpMethodBase
org.apache.webdav.lib.methods.HttpRequestBodyMethodBase
org.apache.webdav.lib.methods.XMLResponseMethodBase
org.apache.webdav.lib.methods.PropFindMethod
- All Implemented Interfaces:
org.apache.commons.httpclient.HttpMethod,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>
-
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
FieldsModifier and TypeFieldDescriptionstatic final intRequest of all properties name and value.static final intRequest of named properties.protected intDepth.static final intRequest of all properties name.protected StringThe namespace abbreviation that prefixes DAV tagsprotected PropertyName[]Property name list.protected intType of the Propfind.Fields inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
builder, decodeResponseHrefs, responseURLsFields inherited from class org.apache.commons.httpclient.HttpMethodBase
effectiveVersion, statusLineFields inherited from interface org.apache.webdav.lib.methods.DepthSupport
DEPTH_0, DEPTH_1, DEPTH_INFINITY -
Constructor Summary
ConstructorsConstructorDescriptionMethod constructor.PropFindMethod(String path) Method constructor.PropFindMethod(String path, int depth) Method constructor.PropFindMethod(String path, int depth, int type) Method constructor.PropFindMethod(String path, int depth, Enumeration propertyNames) Method constructor.PropFindMethod(String path, Enumeration propertyNames) Method constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestHeaders(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) Generate additional headers needed by the request.protected StringDAV requests that contain a body must override this function to generate that body.This method returns an enumeration of URL paths.intgetDepth()Depth getter.getName()getResponseProperties(String urlPath) Returns an enumeration ofPropertyobjects.intgetType()Type getter.voidrecycle()Reset the State of the class to its initial state, so that it can be used again.voidsetDepth(int depth) Depth setter.voidsetPropertyNames(Enumeration propertyNames) Property names setter.voidsetRequestHeader(String headerName, String headerValue) Set a request header value, redirecting the special case of the "Depth" header to invokesetDepth(int)instead.voidsetType(int type) Type setter.Methods inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
convertElementToProperty, getDebug, getRequestContentLength, getResponseDocument, getResponseHashtable, getResponses, getResponseURLs, parseResponse, parseXMLResponse, readResponseBody, setDebug, setDecodeResponseHrefs, setDocument, setResponseHashtable, writeRequestBodyMethods inherited from class org.apache.webdav.lib.methods.HttpRequestBodyMethodBase
isRequestContentAlreadySet, readContinueCode, setRequestBody, setRequestBody, setRequestBody, setRequestBody, setRequestBodyMethods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addCookieRequestHeader, addHostRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getEffectiveVersion, getFollowRedirects, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getParams, getPath, getProxyAuthenticationRealm, getProxyAuthState, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isHttp11, isRequestSent, isStrictMode, processCookieHeaders, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setMethodRetryHandler, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setResponseStream, setStrictMode, setURI, shouldCloseConnection, validate, writeRequest, writeRequestHeaders, writeRequestLine
-
Field Details
-
BY_NAME
public static final int BY_NAMERequest of named properties.- See Also:
-
ALL
public static final int ALLRequest of all properties name and value.- See Also:
-
NAMES
public static final int NAMESRequest of all properties name.- See Also:
-
type
protected int typeType of the Propfind. -
propertyNames
Property name list. -
depth
protected int depthDepth. -
prefix
The namespace abbreviation that prefixes DAV tags
-
-
Constructor Details
-
PropFindMethod
public PropFindMethod()Method constructor. -
PropFindMethod
Method constructor. -
PropFindMethod
Method constructor. -
PropFindMethod
Method constructor. -
PropFindMethod
Method constructor. -
PropFindMethod
Method constructor.
-
-
Method Details
-
setRequestHeader
Set a request header value, redirecting the special case of the "Depth" header to invokesetDepth(int)instead.- Specified by:
setRequestHeaderin interfaceorg.apache.commons.httpclient.HttpMethod- Overrides:
setRequestHeaderin classorg.apache.commons.httpclient.HttpMethodBase- Parameters:
headerName- Header nameheaderValue- 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:
setDepthin interfaceDepthSupport- Parameters:
depth- New depth value
-
getDepth
public int getDepth()Depth getter.- Specified by:
getDepthin interfaceDepthSupport- Returns:
- int depth value
-
setPropertyNames
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:XMLResponseMethodBaseReset the State of the class to its initial state, so that it can be used again.- Specified by:
recyclein interfaceorg.apache.commons.httpclient.HttpMethod- Overrides:
recyclein classXMLResponseMethodBase
-
getName
- Specified by:
getNamein interfaceorg.apache.commons.httpclient.HttpMethod- Specified by:
getNamein classorg.apache.commons.httpclient.HttpMethodBase
-
addRequestHeaders
public void addRequestHeaders(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws IOException, org.apache.commons.httpclient.HttpException Generate additional headers needed by the request.- Overrides:
addRequestHeadersin classorg.apache.commons.httpclient.HttpMethodBase- Parameters:
state- State tokenconn- The connection being used to make the request.- Throws:
IOExceptionorg.apache.commons.httpclient.HttpException
-
generateRequestBody
DAV requests that contain a body must override this function to generate that body.The default behavior simply returns an empty body.
- Overrides:
generateRequestBodyin classXMLResponseMethodBase
-
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
Returns an enumeration ofPropertyobjects.
-