Class RebindMethod

java.lang.Object
org.apache.commons.httpclient.HttpMethodBase
All Implemented Interfaces:
org.apache.commons.httpclient.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 <?xml version="1.0" encoding="utf-8" ?> <D:rebind xmlns:D="DAV:"> <D:segment>foo.html</D:segment> <D:href>http://www.example.com/CollY/bar.html</D:href> </D:rebind> >> 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.
  • Field Details

  • Constructor Details

    • RebindMethod

      public RebindMethod()
      Method constructor.
    • RebindMethod

      public RebindMethod(String existingBinding, String newBinding)
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.apache.commons.httpclient.HttpMethod
      Specified by:
      getName in class org.apache.commons.httpclient.HttpMethodBase
    • 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(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:
      addRequestHeaders in class org.apache.commons.httpclient.HttpMethodBase
      Parameters:
      state - HttpState token
      conn - The connection being used for the request.
      Throws:
      IOException
      org.apache.commons.httpclient.HttpException
    • 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 class XMLResponseMethodBase
    • getHref

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

      public String getSegment()
      Returns:
      new resource name
    • setHref

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

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