org.apache.http.client.methods
Class HttpRequestBase

java.lang.Object
  extended by org.apache.http.message.AbstractHttpMessage
      extended by org.apache.http.client.methods.HttpRequestBase
All Implemented Interfaces:
Cloneable, AbortableHttpRequest, HttpUriRequest, HttpMessage, HttpRequest
Direct Known Subclasses:
HttpDelete, HttpEntityEnclosingRequestBase, HttpGet, HttpHead, HttpOptions, HttpTrace

@NotThreadSafe
public abstract class HttpRequestBase
extends AbstractHttpMessage
implements HttpUriRequest, AbortableHttpRequest, Cloneable

Basic implementation of an HTTP request that can be modified. Methods of the AbortableHttpRequest interface implemented by this class are thread safe.

Since:
4.0

Field Summary
 
Fields inherited from class org.apache.http.message.AbstractHttpMessage
headergroup, params
 
Constructor Summary
HttpRequestBase()
           
 
Method Summary
 void abort()
          Aborts this http request.
 Object clone()
           
abstract  String getMethod()
          Returns the HTTP method this request uses, such as GET, PUT, POST, or other.
 ProtocolVersion getProtocolVersion()
           
 RequestLine getRequestLine()
           
 URI getURI()
          Returns the original request URI.
 boolean isAborted()
          Tests if the request execution has been aborted.
 void releaseConnection()
          A convenience method to simplify migration from HttpClient 3.1 API.
 void reset()
          Resets internal state of the request making it reusable.
 void setConnectionRequest(ClientConnectionRequest connRequest)
          Sets the ClientConnectionRequest callback that can be used to abort a long-lived request for a connection.
 void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger)
          Sets the ConnectionReleaseTrigger callback that can be used to abort an active connection.
 void setURI(URI uri)
           
 String toString()
           
 
Methods inherited from class org.apache.http.message.AbstractHttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
 

Constructor Detail

HttpRequestBase

public HttpRequestBase()
Method Detail

getMethod

public abstract String getMethod()
Description copied from interface: HttpUriRequest
Returns the HTTP method this request uses, such as GET, PUT, POST, or other.

Specified by:
getMethod in interface HttpUriRequest

getProtocolVersion

public ProtocolVersion getProtocolVersion()
Specified by:
getProtocolVersion in interface HttpMessage

getURI

public URI getURI()
Returns the original request URI.

Please note URI remains unchanged in the course of request execution and is not updated if the request is redirected to another location.

Specified by:
getURI in interface HttpUriRequest

getRequestLine

public RequestLine getRequestLine()
Specified by:
getRequestLine in interface HttpRequest

setURI

public void setURI(URI uri)

setConnectionRequest

public void setConnectionRequest(ClientConnectionRequest connRequest)
                          throws IOException
Description copied from interface: AbortableHttpRequest
Sets the ClientConnectionRequest callback that can be used to abort a long-lived request for a connection. If the request is already aborted, throws an IOException.

Specified by:
setConnectionRequest in interface AbortableHttpRequest
Throws:
IOException
See Also:
ClientConnectionManager

setReleaseTrigger

public void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger)
                       throws IOException
Description copied from interface: AbortableHttpRequest
Sets the ConnectionReleaseTrigger callback that can be used to abort an active connection. Typically, this will be the ManagedClientConnection itself. If the request is already aborted, throws an IOException.

Specified by:
setReleaseTrigger in interface AbortableHttpRequest
Throws:
IOException

abort

public void abort()
Description copied from interface: AbortableHttpRequest
Aborts this http request. Any active execution of this method should return immediately. If the request has not started, it will abort after the next execution. Aborting this request will cause all subsequent executions with this request to fail.

Specified by:
abort in interface AbortableHttpRequest
Specified by:
abort in interface HttpUriRequest
See Also:
HttpClient.execute(HttpUriRequest), HttpClient.execute(org.apache.http.HttpHost, org.apache.http.HttpRequest), HttpClient.execute(HttpUriRequest, org.apache.http.protocol.HttpContext), HttpClient.execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext)

isAborted

public boolean isAborted()
Description copied from interface: HttpUriRequest
Tests if the request execution has been aborted.

Specified by:
isAborted in interface HttpUriRequest
Returns:
true if the request execution has been aborted, false otherwise.

reset

public void reset()
Resets internal state of the request making it reusable.

Since:
4.2

releaseConnection

public void releaseConnection()
A convenience method to simplify migration from HttpClient 3.1 API. This method is equivalent to reset().

Since:
4.2

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.