org.apache.webdav.lib.methods
Class RebindMethod

java.lang.Object
  extended byorg.apache.commons.httpclient.HttpMethodBase
      extended byorg.apache.webdav.lib.methods.HttpRequestBodyMethodBase
          extended byorg.apache.webdav.lib.methods.XMLResponseMethodBase
              extended byorg.apache.webdav.lib.methods.RebindMethod
All Implemented Interfaces:
HttpMethod

public class RebindMethod
extends XMLResponseMethodBase

The REBIND method removes a binding to a resource from one collection, and adds a binding to that resource into another collection. It is effectively an atomic form of a MOVE request. REBIND Method Example: >> Request: REBIND /CollX HTTP/1.1 Host: www.example.com Content-Type: text/xml; charset="utf-8" Content-Length: xxx foo.html http://www.example.com/CollY/bar.html >> Response: HTTP/1.1 200 OK The server added a new binding to the collection, "http://www.example.com/CollX", associating "foo.html" with the resource identified by the URI "http://www.example.com/CollY/bar.html", and removes the binding named "bar.html" from the collection identified by the URI "http://www.example.com/CollY". Clients can now use the URI "http://www.example.com/CollX/foo.html" to submit requests to that resource, and requests on the URI "http://www.example.com/CollY/bar.html" will fail with a 404 (Not Found) response.


Nested Class Summary
 
Nested classes inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
XMLResponseMethodBase.OptionsResponse, XMLResponseMethodBase.Response, XMLResponseMethodBase.ResponseWithinMultistatus, XMLResponseMethodBase.SingleResponse
 
Field Summary
static java.lang.String NAME
           
 
Fields inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
builder, responseURLs
 
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase
USER_AGENT
 
Constructor Summary
RebindMethod()
          Method constructor.
RebindMethod(java.lang.String existingBinding, java.lang.String newBinding)
           
 
Method Summary
 void addRequestHeaders(HttpState state, HttpConnection conn)
          Generate additional headers needed by the request.
protected  java.lang.String generateRequestBody()
          DAV requests that contain a body must override this function to generate that body.
 java.lang.String getHref()
           
 java.lang.String getName()
           
 java.lang.String getSegment()
           
 boolean isOverwrite()
          By default, if there already is a binding for the specified segment in the collection, the new binding replaces the existing binding.
 void setHref(java.lang.String href)
           
 void setOverwrite(boolean overwrite)
          By default, if there already is a binding for the specified segment in the collection, the new binding replaces the existing binding.
 void setSegment(java.lang.String segment)
           
 
Methods inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase
convertElementToProperty, getDebug, getRequestContentLength, getResponseDocument, getResponseHashtable, getResponses, getResponseURLs, parseResponse, parseXMLResponse, readResponseBody, recycle, setDebug, setDocument, setResponseHashtable, writeRequestBody
 
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
addAuthorizationRequestHeader, addContentLengthRequestHeader, addCookieRequestHeader, addHostRequestHeader, addProxyAuthorizationRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, fakeResponse, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getFollowRedirects, getHostConfiguration, getMethodRetryHandler, getPath, getProxyAuthenticationRealm, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isConnectionCloseForced, isHttp11, isStrictMode, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setMethodRetryHandler, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, shouldCloseConnection, validate, writeRequest, writeRequestHeaders, writeRequestLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values
Constructor Detail

RebindMethod

public RebindMethod()
Method constructor.


RebindMethod

public RebindMethod(java.lang.String existingBinding,
                    java.lang.String newBinding)
Method Detail

getName

public java.lang.String getName()

isOverwrite

public boolean isOverwrite()
By default, if there already is a binding for the specified segment in the collection, the new binding replaces the existing binding. This default binding replacement behavior can be overridden using the Overwrite header.

Returns:
the current value of the overwrite flag

setOverwrite

public void setOverwrite(boolean overwrite)
By default, if there already is a binding for the specified segment in the collection, the new binding replaces the existing binding. This default binding replacement behavior can be overridden using the Overwrite header.

Parameters:
overwrite - New overwrite value

addRequestHeaders

public void addRequestHeaders(HttpState state,
                              HttpConnection conn)
                       throws java.io.IOException,
                              HttpException
Generate additional headers needed by the request.

Parameters:
state - HttpState token
conn - The connection being used for the request.
Throws:
java.io.IOException
HttpException

generateRequestBody

protected java.lang.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 class XMLResponseMethodBase

getHref

public java.lang.String getHref()
Returns:
path of the resource to be rebound

getSegment

public java.lang.String getSegment()
Returns:
new resource name

setHref

public void setHref(java.lang.String href)
Parameters:
href - path of the resource to be rebound

setSegment

public void setSegment(java.lang.String segment)
Parameters:
segment - new resource name