|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.client.AbstractHttpClient
public abstract class AbstractHttpClient
Convenience base class for HTTP client implementations.
Constructor Summary | |
---|---|
protected |
AbstractHttpClient(ClientConnectionManager conman,
org.apache.http.params.HttpParams params)
Creates a new HTTP client. |
Method Summary | ||
---|---|---|
void |
addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp)
|
|
void |
addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp,
int index)
|
|
void |
addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp)
|
|
void |
addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp,
int index)
|
|
void |
clearRequestInterceptors()
|
|
void |
clearResponseInterceptors()
|
|
protected abstract AuthSchemeRegistry |
createAuthSchemeRegistry()
|
|
protected abstract ClientConnectionManager |
createClientConnectionManager()
|
|
protected RequestDirector |
createClientRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec,
ClientConnectionManager conman,
org.apache.http.ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
org.apache.http.protocol.HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler stateHandler,
org.apache.http.params.HttpParams params)
|
|
protected abstract ConnectionKeepAliveStrategy |
createConnectionKeepAliveStrategy()
|
|
protected abstract org.apache.http.ConnectionReuseStrategy |
createConnectionReuseStrategy()
|
|
protected abstract CookieSpecRegistry |
createCookieSpecRegistry()
|
|
protected abstract CookieStore |
createCookieStore()
|
|
protected abstract CredentialsProvider |
createCredentialsProvider()
|
|
protected abstract org.apache.http.protocol.HttpContext |
createHttpContext()
|
|
protected abstract org.apache.http.params.HttpParams |
createHttpParams()
|
|
protected abstract org.apache.http.protocol.BasicHttpProcessor |
createHttpProcessor()
|
|
protected abstract HttpRequestRetryHandler |
createHttpRequestRetryHandler()
|
|
protected abstract HttpRoutePlanner |
createHttpRoutePlanner()
|
|
protected abstract AuthenticationHandler |
createProxyAuthenticationHandler()
|
|
protected abstract RedirectHandler |
createRedirectHandler()
|
|
protected abstract org.apache.http.protocol.HttpRequestExecutor |
createRequestExecutor()
|
|
protected abstract AuthenticationHandler |
createTargetAuthenticationHandler()
|
|
protected abstract UserTokenHandler |
createUserTokenHandler()
|
|
protected org.apache.http.params.HttpParams |
determineParams(org.apache.http.HttpRequest req)
Obtains parameters for executing a request. |
|
org.apache.http.HttpResponse |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request)
Executes a request to the target using the default context. |
|
org.apache.http.HttpResponse |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context)
Executes a request to the target using the given context. |
|
|
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
ResponseHandler<? extends T> responseHandler)
Executes a request to the target using the default context and processes the response using the given response handler. |
|
|
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context)
Executes a request to the target using the given context and processes the response using the given response handler. |
|
org.apache.http.HttpResponse |
execute(HttpUriRequest request)
Executes a request using the default context. |
|
org.apache.http.HttpResponse |
execute(HttpUriRequest request,
org.apache.http.protocol.HttpContext context)
Maps to execute(target, request, context) . |
|
|
execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the response using the given response handler. |
|
|
execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context)
Executes a request using the given context and processes the response using the given response handler. |
|
AuthSchemeRegistry |
getAuthSchemes()
|
|
ConnectionKeepAliveStrategy |
getConnectionKeepAliveStrategy()
|
|
ClientConnectionManager |
getConnectionManager()
Obtains the connection manager used by this client. |
|
org.apache.http.ConnectionReuseStrategy |
getConnectionReuseStrategy()
|
|
CookieSpecRegistry |
getCookieSpecs()
|
|
CookieStore |
getCookieStore()
|
|
CredentialsProvider |
getCredentialsProvider()
|
|
protected org.apache.http.protocol.BasicHttpProcessor |
getHttpProcessor()
|
|
HttpRequestRetryHandler |
getHttpRequestRetryHandler()
|
|
org.apache.http.params.HttpParams |
getParams()
Obtains the parameters for this client. |
|
AuthenticationHandler |
getProxyAuthenticationHandler()
|
|
RedirectHandler |
getRedirectHandler()
|
|
org.apache.http.protocol.HttpRequestExecutor |
getRequestExecutor()
|
|
org.apache.http.HttpRequestInterceptor |
getRequestInterceptor(int index)
|
|
int |
getRequestInterceptorCount()
|
|
org.apache.http.HttpResponseInterceptor |
getResponseInterceptor(int index)
|
|
int |
getResponseInterceptorCount()
|
|
HttpRoutePlanner |
getRoutePlanner()
|
|
AuthenticationHandler |
getTargetAuthenticationHandler()
|
|
UserTokenHandler |
getUserTokenHandler()
|
|
void |
removeRequestInterceptorByClass(java.lang.Class<? extends org.apache.http.HttpRequestInterceptor> clazz)
|
|
void |
removeResponseInterceptorByClass(java.lang.Class<? extends org.apache.http.HttpResponseInterceptor> clazz)
|
|
void |
setAuthSchemes(AuthSchemeRegistry authSchemeRegistry)
|
|
void |
setCookieSpecs(CookieSpecRegistry cookieSpecRegistry)
|
|
void |
setCookieStore(CookieStore cookieStore)
|
|
void |
setCredentialsProvider(CredentialsProvider credsProvider)
|
|
void |
setHttpRequestRetryHandler(HttpRequestRetryHandler retryHandler)
|
|
void |
setKeepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
|
|
void |
setParams(org.apache.http.params.HttpParams params)
Replaces the parameters. |
|
void |
setProxyAuthenticationHandler(AuthenticationHandler proxyAuthHandler)
|
|
void |
setRedirectHandler(RedirectHandler redirectHandler)
|
|
void |
setReuseStrategy(org.apache.http.ConnectionReuseStrategy reuseStrategy)
|
|
void |
setRoutePlanner(HttpRoutePlanner routePlanner)
|
|
void |
setTargetAuthenticationHandler(AuthenticationHandler targetAuthHandler)
|
|
void |
setUserTokenHandler(UserTokenHandler userTokenHandler)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractHttpClient(ClientConnectionManager conman, org.apache.http.params.HttpParams params)
conman
- the connection managerparams
- the parametersMethod Detail |
---|
protected abstract org.apache.http.params.HttpParams createHttpParams()
protected abstract org.apache.http.protocol.HttpContext createHttpContext()
protected abstract org.apache.http.protocol.HttpRequestExecutor createRequestExecutor()
protected abstract ClientConnectionManager createClientConnectionManager()
protected abstract AuthSchemeRegistry createAuthSchemeRegistry()
protected abstract CookieSpecRegistry createCookieSpecRegistry()
protected abstract org.apache.http.ConnectionReuseStrategy createConnectionReuseStrategy()
protected abstract ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy()
protected abstract org.apache.http.protocol.BasicHttpProcessor createHttpProcessor()
protected abstract HttpRequestRetryHandler createHttpRequestRetryHandler()
protected abstract RedirectHandler createRedirectHandler()
protected abstract AuthenticationHandler createTargetAuthenticationHandler()
protected abstract AuthenticationHandler createProxyAuthenticationHandler()
protected abstract CookieStore createCookieStore()
protected abstract CredentialsProvider createCredentialsProvider()
protected abstract HttpRoutePlanner createHttpRoutePlanner()
protected abstract UserTokenHandler createUserTokenHandler()
public final org.apache.http.params.HttpParams getParams()
HttpClient
getParams
in interface HttpClient
public void setParams(org.apache.http.params.HttpParams params)
params
- the new default parameterspublic final ClientConnectionManager getConnectionManager()
HttpClient
getConnectionManager
in interface HttpClient
public final org.apache.http.protocol.HttpRequestExecutor getRequestExecutor()
public final AuthSchemeRegistry getAuthSchemes()
public void setAuthSchemes(AuthSchemeRegistry authSchemeRegistry)
public final CookieSpecRegistry getCookieSpecs()
public void setCookieSpecs(CookieSpecRegistry cookieSpecRegistry)
public final org.apache.http.ConnectionReuseStrategy getConnectionReuseStrategy()
public void setReuseStrategy(org.apache.http.ConnectionReuseStrategy reuseStrategy)
public final ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy()
public void setKeepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
public final HttpRequestRetryHandler getHttpRequestRetryHandler()
public void setHttpRequestRetryHandler(HttpRequestRetryHandler retryHandler)
public final RedirectHandler getRedirectHandler()
public void setRedirectHandler(RedirectHandler redirectHandler)
public final AuthenticationHandler getTargetAuthenticationHandler()
public void setTargetAuthenticationHandler(AuthenticationHandler targetAuthHandler)
public final AuthenticationHandler getProxyAuthenticationHandler()
public void setProxyAuthenticationHandler(AuthenticationHandler proxyAuthHandler)
public final CookieStore getCookieStore()
public void setCookieStore(CookieStore cookieStore)
public final CredentialsProvider getCredentialsProvider()
public void setCredentialsProvider(CredentialsProvider credsProvider)
public final HttpRoutePlanner getRoutePlanner()
public void setRoutePlanner(HttpRoutePlanner routePlanner)
public final UserTokenHandler getUserTokenHandler()
public void setUserTokenHandler(UserTokenHandler userTokenHandler)
protected final org.apache.http.protocol.BasicHttpProcessor getHttpProcessor()
public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp)
public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp, int index)
public org.apache.http.HttpResponseInterceptor getResponseInterceptor(int index)
public int getResponseInterceptorCount()
public void clearResponseInterceptors()
public void removeResponseInterceptorByClass(java.lang.Class<? extends org.apache.http.HttpResponseInterceptor> clazz)
public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp)
public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp, int index)
public org.apache.http.HttpRequestInterceptor getRequestInterceptor(int index)
public int getRequestInterceptorCount()
public void clearRequestInterceptors()
public void removeRequestInterceptorByClass(java.lang.Class<? extends org.apache.http.HttpRequestInterceptor> clazz)
public final org.apache.http.HttpResponse execute(HttpUriRequest request) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
request
- the request to execute
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic final org.apache.http.HttpResponse execute(HttpUriRequest request, org.apache.http.protocol.HttpContext context) throws java.io.IOException, ClientProtocolException
execute(target, request, context)
.
The target is determined from the URI of the request.
execute
in interface HttpClient
request
- the request to executecontext
- the request-specific execution context,
or null
to use a default context
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic final org.apache.http.HttpResponse execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
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
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic final org.apache.http.HttpResponse execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
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 executecontext
- the context to use for the execution, or
null
to use the default context
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorprotected RequestDirector createClientRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, org.apache.http.params.HttpParams params)
protected org.apache.http.params.HttpParams determineParams(org.apache.http.HttpRequest req)
ClientParamsStack
from the request parameters
and the client parameters.
execute(HttpHost,HttpRequest,HttpContext)
to obtain the parameters for the
DefaultRequestDirector
.
req
- the request that will be executed
public <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
request
- the request to executeresponseHandler
- the response handler
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext context) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
request
- the request to executeresponseHandler
- the response handler
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic <T> T execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, ResponseHandler<? extends T> responseHandler) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
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 executeresponseHandler
- the response handler
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol errorpublic <T> T execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext context) throws java.io.IOException, ClientProtocolException
HttpClient
execute
in interface HttpClient
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 executeresponseHandler
- the response handlercontext
- the context to use for the execution, or
null
to use the default context
java.io.IOException
- in case of a problem or the connection was aborted
ClientProtocolException
- in case of an http protocol error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |