org.apache.webdav.lib.methods

Class RebindMethod


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 <?xml version="1.0" encoding="utf-8" ?> 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/interfaces inherited from class org.apache.webdav.lib.methods.XMLResponseMethodBase

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

Field Summary

static String
NAME

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

builder, decodeResponseHrefs, responseURLs

Constructor Summary

RebindMethod()
Method constructor.
RebindMethod(String existingBinding, String newBinding)

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.
String
getHref()
String
getName()
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(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(String segment)

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

NAME

public static final String NAME

Constructor Details

RebindMethod

public RebindMethod()
Method constructor.

RebindMethod

public RebindMethod(String existingBinding,
                    String newBinding)

Method Details

addRequestHeaders

public void addRequestHeaders(HttpState state,
                              HttpConnection conn)
            throws IOException,
                   HttpException
Generate additional headers needed by the request.
Parameters:
state - HttpState token
conn - The connection being used for 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

getHref

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

getName

public String getName()

getSegment

public String getSegment()
Returns:
new resource name

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

setHref

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

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

setSegment

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