java.lang.Object | |
↳ | org.apache.http.impl.client.AbstractHttpClient |
Known Direct Subclasses |
Known Indirect Subclasses |
Base class for HttpClient
implementations. This class acts as
a facade to a number of special purpose handler or strategy
implementations responsible for handling of a particular aspect of
the HTTP protocol such as redirect or authentication handling or
making decision about connection persistence and keep alive duration.
This enables the users to selectively replace default implementation
of those aspects with custom, application specific ones. This class
also provides factory methods to instantiate those objects:
HttpRequestExecutor
createRequestExecutor()
must be
implemented by concrete super classes to instantiate this object.
BasicHttpProcessor
createHttpProcessor()
must be
implemented by concrete super classes to instantiate this object.
HttpRequestRetryHandler
createHttpRequestRetryHandler()
must be
implemented by concrete super classes to instantiate this object.
ClientConnectionManager
ConnectionReuseStrategy
createConnectionReuseStrategy()
must be
implemented by concrete super classes to instantiate this object.
ConnectionKeepAliveStrategy
createConnectionKeepAliveStrategy()
must be
implemented by concrete super classes to instantiate this object.
CookieSpecRegistry
createCookieSpecRegistry()
must be implemented by concrete
super classes to instantiate this object.
CookieStore
createCookieStore()
must be implemented by
concrete super classes to instantiate this object.
AuthSchemeRegistry
createAuthSchemeRegistry()
must be implemented by concrete
super classes to instantiate this object.
CredentialsProvider
createCredentialsProvider()
must be implemented by concrete super classes to instantiate
this object.
AuthenticationHandler
createTargetAuthenticationHandler()
must be implemented
by concrete super classes to instantiate this object.
AuthenticationHandler
createProxyAuthenticationHandler()
must be implemented
by concrete super classes to instantiate this object.
HttpRoutePlanner
createHttpRoutePlanner()
must be implemented
by concrete super classes to instantiate this object.
RedirectStrategy
UserTokenHandler
createUserTokenHandler()
must be implemented by
concrete super classes to instantiate this object.
This class also maintains a list of protocol interceptors intended for processing outgoing requests and incoming responses and provides methods for managing those interceptors. New protocol interceptors can be introduced to the protocol processor chain or removed from it if needed. Internally protocol interceptors are stored in a simple java.util.ArrayList. They are executed in the same natural order as they are added to the list.
AbstractHttpClient is thread safe. It is recommended that the same
instance of this class is reused for multiple request executions.
When an instance of DefaultHttpClient is no longer needed and is about
to go out of scope the connection manager associated with it must be
shut down by calling shutdown()
!
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new HTTP client.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Executes a request using the default context.
| |||||||||||
Executes a request using the given context and processes the
response using the given response handler.
| |||||||||||
Maps to
execute(target, request, context) . | |||||||||||
Executes a request to the target using the default context and
processes the response using the given response handler.
| |||||||||||
Executes a request to the target using the default context.
| |||||||||||
Executes a request to the target using the given context.
| |||||||||||
Executes a request to the target using the given context and
processes the response using the given response handler.
| |||||||||||
Executes a request using the default context and processes the
response using the given response handler.
| |||||||||||
Obtains the connection manager used by this client.
| |||||||||||
Obtains the parameters for this client.
| |||||||||||
Replaces the parameters.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.http.client.HttpClient
|
Creates a new HTTP client.
conman | the connection manager |
---|---|
params | the parameters |
Executes a request using the default context.
request | the request to execute |
---|
Executes a request using the given context and processes the response using the given response handler.
request | the request to execute |
---|---|
responseHandler | the response handler |
Maps to execute(target, request, context)
.
The target is determined from the URI of the request.
request | the request to execute |
---|---|
context | the request-specific execution context,
or null to use a default context
|
Executes a request to the target using the default context and processes the response using the given response handler.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
responseHandler | the response handler |
Executes a request to the target using the default context.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
Executes a request to the target using the given context.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
context | the context to use for the execution, or
null to use the default context |
Executes a request to the target using the given context and processes the response using the given response handler.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
responseHandler | the response handler |
context | the context to use for the execution, or
null to use the default context |
Executes a request using the default context and processes the response using the given response handler.
request | the request to execute |
---|---|
responseHandler | the response handler |
Obtains the connection manager used by this client.
Obtains the parameters for this client. These parameters will become defaults for all requests being executed with this client, and for the parameters of dependent objects in this client.
Replaces the parameters. The implementation here does not update parameters of dependent objects.
params | the new default parameters |
---|
Obtains parameters for executing a request.
The default implementation in this class creates a new
ClientParamsStack
from the request parameters
and the client parameters.
This method is called by the default implementation of
execute(HttpHost, HttpRequest, HttpContext)
to obtain the parameters for the
DefaultRequestDirector
.
req | the request that will be executed |
---|