org.apache.webdav.lib.methods

Class BindMethod


public class BindMethod
extends XMLResponseMethodBase

The BIND method modifies the collection identified by the Request-URI, by adding a new binding from the segment specified in the BIND body to the resource identified in the BIND body. BIND Method Example: >> Request: BIND /CollY HTTP/1.1 Host: www.example.com Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="utf-8" ?> bar.html http://www.example.com/CollX/foo.html >> Response: HTTP/1.1 201 Created The server added a new binding to the collection, "http://www.example.com/CollY", associating "bar.html" with the resource identified by the URI "http://www.example.com/CollX/foo.html". Clients can now use the URI "http://www.example.com/CollY/bar.html", to submit requests to that resource.

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

BindMethod()
Method constructor.
BindMethod(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

BindMethod

public BindMethod()
Method constructor.

BindMethod

public BindMethod(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 bound

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 bound

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