Package org.apache.webdav.lib.methods
Class XMLResponseMethodBase
java.lang.Object
org.apache.commons.httpclient.HttpMethodBase
org.apache.webdav.lib.methods.HttpRequestBodyMethodBase
org.apache.webdav.lib.methods.XMLResponseMethodBase
- All Implemented Interfaces:
org.apache.commons.httpclient.HttpMethod
- Direct Known Subclasses:
AclMethod
,AclReportMethod
,BindMethod
,CheckinMethod
,CheckoutMethod
,CopyMethod
,DeleteMethod
,LabelMethod
,LockMethod
,MkWorkspaceMethod
,MoveMethod
,OptionsMethod
,PollMethod
,PropFindMethod
,PropPatchMethod
,RebindMethod
,ReportMethod
,SearchMethod
,SubscribeMethod
,UnbindMethod
,UncheckoutMethod
,UnlockMethod
,UnsubscribeMethod
,UpdateMethod
,VersionControlMethod
Utility class for XML response parsing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
class
An abstract class that models a DAV:response.(package private) class
A class that models the DAV:response element within a multistatus.(package private) class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentBuilder
Document builder.protected String
protected Vector
Vector of response nodes, to keep track of insertion order FIXME: the above Hashtable and this Vector should be ported to plain CollectionsFields inherited from class org.apache.commons.httpclient.HttpMethodBase
effectiveVersion, statusLine
-
Constructor Summary
ConstructorsConstructorDescriptionMethod constructor.Method constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static Property
convertElementToProperty
(XMLResponseMethodBase.Response response, Element element) This method creates a property implementation from an element.protected String
DAV requests that contain a body must override this function to generate that body.int
getDebug()
Debug property getter.protected int
Return the length (in bytes) of my request body, suitable for use in a Content-Length header.Response document getter.protected Hashtable
Return an enumeration containing the responses.protected Vector
void
parseResponse
(InputStream input, org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) Parse response.protected void
parseXMLResponse
(InputStream input) protected void
readResponseBody
(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) void
recycle()
Reset the State of the class to its initial state, so that it can be used again.void
setDebug
(int debug) Debug property setter.void
setDecodeResponseHrefs
(String encoding) Sets whether the href in responses are decoded, as early as possible.protected void
setDocument
(Document doc) protected void
protected boolean
writeRequestBody
(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) Write the request body to the givenHttpConnection
.Methods inherited from class org.apache.webdav.lib.methods.HttpRequestBodyMethodBase
isRequestContentAlreadySet, readContinueCode, setRequestBody, setRequestBody, setRequestBody, setRequestBody, setRequestBody
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addCookieRequestHeader, addHostRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addRequestHeaders, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getEffectiveVersion, getFollowRedirects, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getName, 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, setRequestHeader, setResponseStream, setStrictMode, setURI, shouldCloseConnection, validate, writeRequest, writeRequestHeaders, writeRequestLine
-
Field Details
-
builder
Document builder. -
responseURLs
Vector of response nodes, to keep track of insertion order FIXME: the above Hashtable and this Vector should be ported to plain Collections -
decodeResponseHrefs
-
-
Constructor Details
-
XMLResponseMethodBase
public XMLResponseMethodBase()Method constructor. -
XMLResponseMethodBase
Method constructor.- Parameters:
uri
- the URI to request
-
-
Method Details
-
getResponseDocument
Response document getter.- Returns:
- Document response document
-
getResponses
Return an enumeration containing the responses.- Returns:
- An enumeration containing objects implementing the ResponseEntity interface
-
setDebug
public void setDebug(int debug) Debug property setter.- Parameters:
int
- Debug
-
getDebug
public int getDebug()Debug property getter. -
setDecodeResponseHrefs
Sets whether the href in responses are decoded, as early as possible. Thehref
data in responses is often url-encoded, but not alwyas in a comparable way. Set this to a non-null value to decode the hrefs as early as possible.- Parameters:
encoding
- The encoding used in while decoding (UTF-8 is recommended)
-
recycle
public void recycle()Reset the State of the class to its initial state, so that it can be used again.- Specified by:
recycle
in interfaceorg.apache.commons.httpclient.HttpMethod
- Overrides:
recycle
in classHttpRequestBodyMethodBase
-
readResponseBody
protected void readResponseBody(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws IOException, org.apache.commons.httpclient.HttpException - Overrides:
readResponseBody
in classorg.apache.commons.httpclient.HttpMethodBase
- Throws:
IOException
org.apache.commons.httpclient.HttpException
-
getRequestContentLength
protected int getRequestContentLength()Return the length (in bytes) of my request body, suitable for use in a Content-Length header.Return -1 when the content-length is unknown.
This implementation returns 0, indicating that the request has no body.
- Overrides:
getRequestContentLength
in classHttpRequestBodyMethodBase
- Returns:
- 0, indicating that the request has no body.
-
generateRequestBody
DAV requests that contain a body must override this function to generate that body.The default behavior simply returns an empty body.
-
writeRequestBody
protected boolean writeRequestBody(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws IOException, org.apache.commons.httpclient.HttpException Write the request body to the givenHttpConnection
.This implementation writes any computed body and returns true.
- Overrides:
writeRequestBody
in classHttpRequestBodyMethodBase
- Parameters:
state
- the client stateconn
- the connection to write to- Returns:
- true
- Throws:
IOException
- when i/o errors occur reading the responseorg.apache.commons.httpclient.HttpException
- when a protocol error occurs or state is invalid
-
parseResponse
public void parseResponse(InputStream input, org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws IOException, org.apache.commons.httpclient.HttpException Parse response.- Parameters:
input
- Input stream- Throws:
IOException
org.apache.commons.httpclient.HttpException
-
parseXMLResponse
protected void parseXMLResponse(InputStream input) throws IOException, org.apache.commons.httpclient.HttpException - Throws:
IOException
org.apache.commons.httpclient.HttpException
-
getResponseHashtable
-
getResponseURLs
-
convertElementToProperty
protected static Property convertElementToProperty(XMLResponseMethodBase.Response response, Element element) This method creates a property implementation from an element. It treats known properties (i.e., the DAV properties) specially. These properties are instantiated as an implementation from theorg.apache.webdav.lib.properties
package. -
setDocument
-
setResponseHashtable
-