org.apache.http.impl.client.AbstractHttpClient
Convenience base class for HTTP client implementations.
Known Direct Subclasses
Summary
Protected Constructors
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Protected Constructors
Creates a new HTTP client.
Parameters
| conman
| the connection manager |
| params
| the parameters
|
Public Methods
public
synchronized
void
addRequestInterceptor(HttpRequestInterceptor itcp)
Appends a request interceptor to this list.
public
synchronized
void
addRequestInterceptor(HttpRequestInterceptor itcp, int index)
Inserts a request interceptor at the specified index.
public
synchronized
void
addResponseInterceptor(HttpResponseInterceptor itcp, int index)
Inserts a response interceptor at the specified index.
public
synchronized
void
addResponseInterceptor(HttpResponseInterceptor itcp)
Appends a response interceptor to this list.
public
synchronized
void
clearRequestInterceptors()
Removes all request interceptors from this list.
public
synchronized
void
clearResponseInterceptors()
Removes all response interceptors from this list.
Maps to
execute(roureq, context).
The route is computed by
determineRoute.
Parameters
| request
| the request to execute |
| context
| the request-specific execution context,
or null to use a default context
|
Executes a request along the given route.
public
final
synchronized
ClientConnectionManager
getConnectionManager()
Obtains the connection manager used by this client.
public
final
synchronized
HttpContext
getDefaultContext()
Obtains the default context used by this client populated with
default attributes. This context will be used by default when
executing requests with this client.
public
final
synchronized
HttpParams
getParams()
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.
public
synchronized
HttpRequestInterceptor
getRequestInterceptor(int index)
Obtains a request interceptor from this list.
public
synchronized
int
getRequestInterceptorCount()
Obtains the current size of this list.
public
synchronized
HttpResponseInterceptor
getResponseInterceptor(int index)
Obtains a response interceptor from this list.
public
synchronized
int
getResponseInterceptorCount()
Obtains the current size of this list.
public
void
removeRequestInterceptorByClass(Class clazz)
Removes all request interceptor of the specified class
public
void
removeResponseInterceptorByClass(Class clazz)
Removes all response interceptor of the specified class
public
synchronized
void
setCookieStore(CookieStore cookieStore)
public
synchronized
void
setInterceptors(List itcps)
Sets the request interceptors in this list.
This list will be cleared and re-initialized to contain
all request interceptors from the argument list.
If the argument list includes elements that are not request
interceptors, the behavior is implementation dependent.
public
synchronized
void
setParams(HttpParams params)
Replaces the parameters.
The implementation here does not update parameters of dependent objects.
Parameters
| params
| the new default parameters
|
public
synchronized
void
setRedirectHandler(RedirectHandler redirectHandler)
Protected Methods
Determines the route for a request.
Called by
execute(urirequest, context)
to map to
execute(roureq, context).
Parameters
| 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,
never null |
Returns
- the request along with the route it should take
protected
abstract
void
populateContext(HttpContext context)