org.apache.http.impl.client
Class AbstractHttpClient

java.lang.Object
  extended by org.apache.http.impl.client.CloseableHttpClient
      extended by org.apache.http.impl.client.AbstractHttpClient
All Implemented Interfaces:
Closeable, HttpClient
Direct Known Subclasses:
DefaultHttpClient

Deprecated. (4.3) use HttpClientBuilder.

@Contract(threading=SAFE_CONDITIONAL)
@Deprecated
public abstract class AbstractHttpClient
extends CloseableHttpClient

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:

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 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 ClientConnectionManager.shutdown()!

Since:
4.0

Constructor Summary
protected AbstractHttpClient(ClientConnectionManager conman, org.apache.http.params.HttpParams params)
          Deprecated. Creates a new HTTP client.
 
Method Summary
 void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp)
          Deprecated.  
 void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp, int index)
          Deprecated.  
 void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp)
          Deprecated.  
 void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp, int index)
          Deprecated.  
 void clearRequestInterceptors()
          Deprecated.  
 void clearResponseInterceptors()
          Deprecated.  
 void close()
          Deprecated.  
protected  AuthSchemeRegistry createAuthSchemeRegistry()
          Deprecated.  
protected  ClientConnectionManager createClientConnectionManager()
          Deprecated.  
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 userTokenHandler, org.apache.http.params.HttpParams params)
          Deprecated. (4.1) do not use
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, RedirectStrategy redirectStrategy, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params)
          Deprecated. (4.2) do not use
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, RedirectStrategy redirectStrategy, AuthenticationStrategy targetAuthStrategy, AuthenticationStrategy proxyAuthStrategy, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params)
          Deprecated.  
protected  ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy()
          Deprecated.  
protected  org.apache.http.ConnectionReuseStrategy createConnectionReuseStrategy()
          Deprecated.  
protected  CookieSpecRegistry createCookieSpecRegistry()
          Deprecated.  
protected  CookieStore createCookieStore()
          Deprecated.  
protected  CredentialsProvider createCredentialsProvider()
          Deprecated.  
protected  org.apache.http.protocol.HttpContext createHttpContext()
          Deprecated.  
protected abstract  org.apache.http.params.HttpParams createHttpParams()
          Deprecated.  
protected abstract  org.apache.http.protocol.BasicHttpProcessor createHttpProcessor()
          Deprecated.  
protected  HttpRequestRetryHandler createHttpRequestRetryHandler()
          Deprecated.  
protected  HttpRoutePlanner createHttpRoutePlanner()
          Deprecated.  
protected  AuthenticationHandler createProxyAuthenticationHandler()
          Deprecated. (4.2) do not use
protected  AuthenticationStrategy createProxyAuthenticationStrategy()
          Deprecated.  
protected  RedirectHandler createRedirectHandler()
          Deprecated. (4.1) do not use
protected  org.apache.http.protocol.HttpRequestExecutor createRequestExecutor()
          Deprecated.  
protected  AuthenticationHandler createTargetAuthenticationHandler()
          Deprecated. (4.2) do not use
protected  AuthenticationStrategy createTargetAuthenticationStrategy()
          Deprecated.  
protected  UserTokenHandler createUserTokenHandler()
          Deprecated.  
protected  org.apache.http.params.HttpParams determineParams(org.apache.http.HttpRequest req)
          Deprecated. Obtains parameters for executing a request.
protected  CloseableHttpResponse doExecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)
          Deprecated.  
 AuthSchemeRegistry getAuthSchemes()
          Deprecated.  
 BackoffManager getBackoffManager()
          Deprecated.  
 ConnectionBackoffStrategy getConnectionBackoffStrategy()
          Deprecated.  
 ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy()
          Deprecated.  
 ClientConnectionManager getConnectionManager()
          Deprecated. Obtains the connection manager used by this client.
 org.apache.http.ConnectionReuseStrategy getConnectionReuseStrategy()
          Deprecated.  
 CookieSpecRegistry getCookieSpecs()
          Deprecated.  
 CookieStore getCookieStore()
          Deprecated.  
 CredentialsProvider getCredentialsProvider()
          Deprecated.  
protected  org.apache.http.protocol.BasicHttpProcessor getHttpProcessor()
          Deprecated.  
 HttpRequestRetryHandler getHttpRequestRetryHandler()
          Deprecated.  
 org.apache.http.params.HttpParams getParams()
          Deprecated. Obtains the parameters for this client.
 AuthenticationHandler getProxyAuthenticationHandler()
          Deprecated. (4.2) do not use
 AuthenticationStrategy getProxyAuthenticationStrategy()
          Deprecated.  
 RedirectHandler getRedirectHandler()
          Deprecated. (4.1) do not use
 RedirectStrategy getRedirectStrategy()
          Deprecated.  
 org.apache.http.protocol.HttpRequestExecutor getRequestExecutor()
          Deprecated.  
 org.apache.http.HttpRequestInterceptor getRequestInterceptor(int index)
          Deprecated.  
 int getRequestInterceptorCount()
          Deprecated.  
 org.apache.http.HttpResponseInterceptor getResponseInterceptor(int index)
          Deprecated.  
 int getResponseInterceptorCount()
          Deprecated.  
 HttpRoutePlanner getRoutePlanner()
          Deprecated.  
 AuthenticationHandler getTargetAuthenticationHandler()
          Deprecated. (4.2) do not use
 AuthenticationStrategy getTargetAuthenticationStrategy()
          Deprecated.  
 UserTokenHandler getUserTokenHandler()
          Deprecated.  
 void removeRequestInterceptorByClass(Class<? extends org.apache.http.HttpRequestInterceptor> clazz)
          Deprecated.  
 void removeResponseInterceptorByClass(Class<? extends org.apache.http.HttpResponseInterceptor> clazz)
          Deprecated.  
 void setAuthSchemes(AuthSchemeRegistry registry)
          Deprecated.  
 void setBackoffManager(BackoffManager manager)
          Deprecated.  
 void setConnectionBackoffStrategy(ConnectionBackoffStrategy strategy)
          Deprecated.  
 void setCookieSpecs(CookieSpecRegistry registry)
          Deprecated.  
 void setCookieStore(CookieStore cookieStore)
          Deprecated.  
 void setCredentialsProvider(CredentialsProvider credsProvider)
          Deprecated.  
 void setHttpRequestRetryHandler(HttpRequestRetryHandler handler)
          Deprecated.  
 void setKeepAliveStrategy(ConnectionKeepAliveStrategy strategy)
          Deprecated.  
 void setParams(org.apache.http.params.HttpParams params)
          Deprecated. Replaces the parameters.
 void setProxyAuthenticationHandler(AuthenticationHandler handler)
          Deprecated. (4.2) do not use
 void setProxyAuthenticationStrategy(AuthenticationStrategy strategy)
          Deprecated.  
 void setRedirectHandler(RedirectHandler handler)
          Deprecated. (4.1) do not use
 void setRedirectStrategy(RedirectStrategy strategy)
          Deprecated.  
 void setReuseStrategy(org.apache.http.ConnectionReuseStrategy strategy)
          Deprecated.  
 void setRoutePlanner(HttpRoutePlanner routePlanner)
          Deprecated.  
 void setTargetAuthenticationHandler(AuthenticationHandler handler)
          Deprecated. (4.2) do not use
 void setTargetAuthenticationStrategy(AuthenticationStrategy strategy)
          Deprecated.  
 void setUserTokenHandler(UserTokenHandler handler)
          Deprecated.  
 
Methods inherited from class org.apache.http.impl.client.CloseableHttpClient
execute, execute, execute, execute, execute, execute, execute, execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHttpClient

protected AbstractHttpClient(ClientConnectionManager conman,
                             org.apache.http.params.HttpParams params)
Deprecated. 
Creates a new HTTP client.

Parameters:
conman - the connection manager
params - the parameters
Method Detail

createHttpParams

protected abstract org.apache.http.params.HttpParams createHttpParams()
Deprecated. 

createHttpProcessor

protected abstract org.apache.http.protocol.BasicHttpProcessor createHttpProcessor()
Deprecated. 

createHttpContext

protected org.apache.http.protocol.HttpContext createHttpContext()
Deprecated. 

createClientConnectionManager

protected ClientConnectionManager createClientConnectionManager()
Deprecated. 

createAuthSchemeRegistry

protected AuthSchemeRegistry createAuthSchemeRegistry()
Deprecated. 

createCookieSpecRegistry

protected CookieSpecRegistry createCookieSpecRegistry()
Deprecated. 

createRequestExecutor

protected org.apache.http.protocol.HttpRequestExecutor createRequestExecutor()
Deprecated. 

createConnectionReuseStrategy

protected org.apache.http.ConnectionReuseStrategy createConnectionReuseStrategy()
Deprecated. 

createConnectionKeepAliveStrategy

protected ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy()
Deprecated. 

createHttpRequestRetryHandler

protected HttpRequestRetryHandler createHttpRequestRetryHandler()
Deprecated. 

createRedirectHandler

@Deprecated
protected RedirectHandler createRedirectHandler()
Deprecated. (4.1) do not use


createTargetAuthenticationStrategy

protected AuthenticationStrategy createTargetAuthenticationStrategy()
Deprecated. 

createTargetAuthenticationHandler

@Deprecated
protected AuthenticationHandler createTargetAuthenticationHandler()
Deprecated. (4.2) do not use


createProxyAuthenticationStrategy

protected AuthenticationStrategy createProxyAuthenticationStrategy()
Deprecated. 

createProxyAuthenticationHandler

@Deprecated
protected AuthenticationHandler createProxyAuthenticationHandler()
Deprecated. (4.2) do not use


createCookieStore

protected CookieStore createCookieStore()
Deprecated. 

createCredentialsProvider

protected CredentialsProvider createCredentialsProvider()
Deprecated. 

createHttpRoutePlanner

protected HttpRoutePlanner createHttpRoutePlanner()
Deprecated. 

createUserTokenHandler

protected UserTokenHandler createUserTokenHandler()
Deprecated. 

getParams

public final org.apache.http.params.HttpParams getParams()
Deprecated. 
Description copied from interface: HttpClient
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.

Returns:
the default parameters

setParams

public void setParams(org.apache.http.params.HttpParams params)
Deprecated. 
Replaces the parameters. The implementation here does not update parameters of dependent objects.

Parameters:
params - the new default parameters

getConnectionManager

public final ClientConnectionManager getConnectionManager()
Deprecated. 
Description copied from interface: HttpClient
Obtains the connection manager used by this client.

Returns:
the connection manager

getRequestExecutor

public final org.apache.http.protocol.HttpRequestExecutor getRequestExecutor()
Deprecated. 

getAuthSchemes

public final AuthSchemeRegistry getAuthSchemes()
Deprecated. 

setAuthSchemes

public void setAuthSchemes(AuthSchemeRegistry registry)
Deprecated. 

getConnectionBackoffStrategy

public final ConnectionBackoffStrategy getConnectionBackoffStrategy()
Deprecated. 

setConnectionBackoffStrategy

public void setConnectionBackoffStrategy(ConnectionBackoffStrategy strategy)
Deprecated. 

getCookieSpecs

public final CookieSpecRegistry getCookieSpecs()
Deprecated. 

getBackoffManager

public final BackoffManager getBackoffManager()
Deprecated. 

setBackoffManager

public void setBackoffManager(BackoffManager manager)
Deprecated. 

setCookieSpecs

public void setCookieSpecs(CookieSpecRegistry registry)
Deprecated. 

getConnectionReuseStrategy

public final org.apache.http.ConnectionReuseStrategy getConnectionReuseStrategy()
Deprecated. 

setReuseStrategy

public void setReuseStrategy(org.apache.http.ConnectionReuseStrategy strategy)
Deprecated. 

getConnectionKeepAliveStrategy

public final ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy()
Deprecated. 

setKeepAliveStrategy

public void setKeepAliveStrategy(ConnectionKeepAliveStrategy strategy)
Deprecated. 

getHttpRequestRetryHandler

public final HttpRequestRetryHandler getHttpRequestRetryHandler()
Deprecated. 

setHttpRequestRetryHandler

public void setHttpRequestRetryHandler(HttpRequestRetryHandler handler)
Deprecated. 

getRedirectHandler

@Deprecated
public final RedirectHandler getRedirectHandler()
Deprecated. (4.1) do not use


setRedirectHandler

@Deprecated
public void setRedirectHandler(RedirectHandler handler)
Deprecated. (4.1) do not use


getRedirectStrategy

public final RedirectStrategy getRedirectStrategy()
Deprecated. 
Since:
4.1

setRedirectStrategy

public void setRedirectStrategy(RedirectStrategy strategy)
Deprecated. 
Since:
4.1

getTargetAuthenticationHandler

@Deprecated
public final AuthenticationHandler getTargetAuthenticationHandler()
Deprecated. (4.2) do not use


setTargetAuthenticationHandler

@Deprecated
public void setTargetAuthenticationHandler(AuthenticationHandler handler)
Deprecated. (4.2) do not use


getTargetAuthenticationStrategy

public final AuthenticationStrategy getTargetAuthenticationStrategy()
Deprecated. 
Since:
4.2

setTargetAuthenticationStrategy

public void setTargetAuthenticationStrategy(AuthenticationStrategy strategy)
Deprecated. 
Since:
4.2

getProxyAuthenticationHandler

@Deprecated
public final AuthenticationHandler getProxyAuthenticationHandler()
Deprecated. (4.2) do not use


setProxyAuthenticationHandler

@Deprecated
public void setProxyAuthenticationHandler(AuthenticationHandler handler)
Deprecated. (4.2) do not use


getProxyAuthenticationStrategy

public final AuthenticationStrategy getProxyAuthenticationStrategy()
Deprecated. 
Since:
4.2

setProxyAuthenticationStrategy

public void setProxyAuthenticationStrategy(AuthenticationStrategy strategy)
Deprecated. 
Since:
4.2

getCookieStore

public final CookieStore getCookieStore()
Deprecated. 

setCookieStore

public void setCookieStore(CookieStore cookieStore)
Deprecated. 

getCredentialsProvider

public final CredentialsProvider getCredentialsProvider()
Deprecated. 

setCredentialsProvider

public void setCredentialsProvider(CredentialsProvider credsProvider)
Deprecated. 

getRoutePlanner

public final HttpRoutePlanner getRoutePlanner()
Deprecated. 

setRoutePlanner

public void setRoutePlanner(HttpRoutePlanner routePlanner)
Deprecated. 

getUserTokenHandler

public final UserTokenHandler getUserTokenHandler()
Deprecated. 

setUserTokenHandler

public void setUserTokenHandler(UserTokenHandler handler)
Deprecated. 

getHttpProcessor

protected final org.apache.http.protocol.BasicHttpProcessor getHttpProcessor()
Deprecated. 

getResponseInterceptorCount

public int getResponseInterceptorCount()
Deprecated. 

getResponseInterceptor

public org.apache.http.HttpResponseInterceptor getResponseInterceptor(int index)
Deprecated. 

getRequestInterceptor

public org.apache.http.HttpRequestInterceptor getRequestInterceptor(int index)
Deprecated. 

getRequestInterceptorCount

public int getRequestInterceptorCount()
Deprecated. 

addResponseInterceptor

public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp)
Deprecated. 

addResponseInterceptor

public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp,
                                   int index)
Deprecated. 

clearResponseInterceptors

public void clearResponseInterceptors()
Deprecated. 

removeResponseInterceptorByClass

public void removeResponseInterceptorByClass(Class<? extends org.apache.http.HttpResponseInterceptor> clazz)
Deprecated. 

addRequestInterceptor

public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp)
Deprecated. 

addRequestInterceptor

public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp,
                                  int index)
Deprecated. 

clearRequestInterceptors

public void clearRequestInterceptors()
Deprecated. 

removeRequestInterceptorByClass

public void removeRequestInterceptorByClass(Class<? extends org.apache.http.HttpRequestInterceptor> clazz)
Deprecated. 

doExecute

protected final CloseableHttpResponse doExecute(org.apache.http.HttpHost target,
                                                org.apache.http.HttpRequest request,
                                                org.apache.http.protocol.HttpContext context)
                                         throws IOException,
                                                ClientProtocolException
Deprecated. 
Specified by:
doExecute in class CloseableHttpClient
Throws:
IOException
ClientProtocolException

createClientRequestDirector

@Deprecated
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 userTokenHandler,
                                                                 org.apache.http.params.HttpParams params)
Deprecated. (4.1) do not use


createClientRequestDirector

@Deprecated
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,
                                                                 RedirectStrategy redirectStrategy,
                                                                 AuthenticationHandler targetAuthHandler,
                                                                 AuthenticationHandler proxyAuthHandler,
                                                                 UserTokenHandler userTokenHandler,
                                                                 org.apache.http.params.HttpParams params)
Deprecated. (4.2) do not use


createClientRequestDirector

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,
                                                      RedirectStrategy redirectStrategy,
                                                      AuthenticationStrategy targetAuthStrategy,
                                                      AuthenticationStrategy proxyAuthStrategy,
                                                      UserTokenHandler userTokenHandler,
                                                      org.apache.http.params.HttpParams params)
Deprecated. 
Since:
4.2

determineParams

protected org.apache.http.params.HttpParams determineParams(org.apache.http.HttpRequest req)
Deprecated. 
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 CloseableHttpClient.execute(HttpHost,HttpRequest,HttpContext) to obtain the parameters for the DefaultRequestDirector.

Parameters:
req - the request that will be executed
Returns:
the parameters to use

close

public void close()
Deprecated. 


Copyright © 1999–2019 The Apache Software Foundation. All rights reserved.