Top Description Fields Constructors Methods
org.apache.http.impl.client

public Class AutoRetryHttpClient

extends Object
implements HttpClient
Class Inheritance
All Implemented Interfaces
org.apache.http.client.HttpClient
Annotations
@Deprecated
@Contract
threading:SAFE_CONDITIONAL
Imports
java.io.IOException, .InterruptedIOException, java.net.URI, org.apache.commons.logging.Log, .LogFactory, org.apache.http.HttpHost, .HttpRequest, .HttpResponse, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.client.HttpClient, .ResponseHandler, .ServiceUnavailableRetryStrategy, org.apache.http.client.methods.HttpUriRequest, org.apache.http.conn.ClientConnectionManager, org.apache.http.params.HttpParams, org.apache.http.protocol.HttpContext, org.apache.http.util.Args, .EntityUtils

Deprecated

(4.3) use HttpClientBuilder.

HttpClient implementation that can automatically retry the request in case of a non-2xx response using the ServiceUnavailableRetryStrategy interface.
Since
4.2

Field Summary

Modifier and TypeField and Description
private final HttpClient
private final Log
private final ServiceUnavailableRetryStrategy

Constructor Summary

AccessConstructor and Description
public
public
AutoRetryHttpClient()

Constructs a AutoRetryHttpClient with default caching settings that stores cache entries in memory and uses a vanilla DefaultHttpClient for backend requests.

public
AutoRetryHttpClient(final ServiceUnavailableRetryStrategy
retry configuration module options
config
)

Constructs a AutoRetryHttpClient with the given caching options that stores cache entries in memory and uses a vanilla DefaultHttpClient for backend requests.

public
AutoRetryHttpClient(final HttpClient
used to make origin requests
client
)

Constructs a AutoRetryHttpClient with default caching settings that stores cache entries in memory and uses the given HttpClient for backend requests.

Method Summary

Modifier and TypeMethod and Description
public HttpResponse
execute(final HttpHost
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.
target
,
final HttpRequest
the request to execute
request
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context.
public <T> T
execute(final HttpHost
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.
target
,
final HttpRequest
the request to execute
request
,
final ResponseHandler<? extends T>
the response handler
responseHandler
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request to the target using the default context and processes the response using the given response handler.
public <T> T
execute(final HttpHost
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.
target
,
final HttpRequest
the request to execute
request
,
final ResponseHandler<? extends T>
the response handler
responseHandler
,
final HttpContext
the context to use for the execution, or null to use the default context
context
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request to the target using the given context and processes the response using the given response handler.
public HttpResponse
execute(final HttpUriRequest
the request to execute
request
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context.
public HttpResponse
execute(final HttpUriRequest
the request to execute
request
,
final HttpContext
the context to use for the execution, or null to use the default context
context
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context.
public <T> T
execute(final HttpUriRequest
the request to execute
request
,
final ResponseHandler<? extends T>
the response handler
responseHandler
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context and processes the response using the given response handler.
public <T> T
execute(final HttpUriRequest
the request to execute
request
,
final ResponseHandler<? extends T>
the response handler
responseHandler
,
final HttpContext
the context to use for the execution, or null to use the default context
context
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context and processes the response using the given response handler.
public HttpResponse
execute(final HttpHost
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.
target
,
final HttpRequest
the request to execute
request
,
final HttpContext
the context to use for the execution, or null to use the default context
context
)

Implements org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context.
public ClientConnectionManager
getConnectionManager()

Implements org.apache.http.client.HttpClient.getConnectionManager.

Deprecated as a consequence of ClientConnectionManager being deprecated.
Obtains the connection manager used by this client.
public HttpParams
getParams()

Implements org.apache.http.client.HttpClient.getParams.

Deprecated as a consequence of HttpParams being deprecated.
Obtains the parameters for this client.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backendback to summary
private final HttpClient backend
logback to summary
private final Log log
retryStrategyback to summary
private final ServiceUnavailableRetryStrategy retryStrategy

Constructor Detail

AutoRetryHttpClientback to summary
public AutoRetryHttpClient(final HttpClient client, final ServiceUnavailableRetryStrategy retryStrategy)
AutoRetryHttpClientback to summary
public AutoRetryHttpClient()

Constructs a AutoRetryHttpClient with default caching settings that stores cache entries in memory and uses a vanilla DefaultHttpClient for backend requests.

AutoRetryHttpClientback to summary
public AutoRetryHttpClient(final ServiceUnavailableRetryStrategy config)

Constructs a AutoRetryHttpClient with the given caching options that stores cache entries in memory and uses a vanilla DefaultHttpClient for backend requests.

Parameters
config:ServiceUnavailableRetryStrategy

retry configuration module options

AutoRetryHttpClientback to summary
public AutoRetryHttpClient(final HttpClient client)

Constructs a AutoRetryHttpClient with default caching settings that stores cache entries in memory and uses the given HttpClient for backend requests.

Parameters
client:HttpClient

used to make origin requests

Method Detail

executeback to summary
public HttpResponse execute(final HttpHost target, final HttpRequest request) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context.

Parameters
target:HttpHost

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:HttpRequest

the request to execute

Returns:HttpResponse

the response to the request. This is always a final response, never an intermediate response with an 1xx status code. Whether redirects or authentication challenges will be returned or handled automatically depends on the implementation and configuration of this client.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public <T> T execute(final HttpHost target, final HttpRequest request, final ResponseHandler<? extends T> responseHandler) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request to the target using the default context and processes the response using the given response handler.

Implementing classes are required to ensure that the content entity associated with the response is fully consumed and the underlying connection is released back to the connection manager automatically in all cases relieving individual ResponseHandlers from having to manage resource deallocation internally.

Parameters
target:HttpHost

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:HttpRequest

the request to execute

responseHandler:ResponseHandler<? extends T>

the response handler

Returns:T

the response object as generated by the response handler.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public <T> T execute(final HttpHost target, final HttpRequest request, final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request to the target using the given context and processes the response using the given response handler.

Implementing classes are required to ensure that the content entity associated with the response is fully consumed and the underlying connection is released back to the connection manager automatically in all cases relieving individual ResponseHandlers from having to manage resource deallocation internally.

Parameters
target:HttpHost

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:HttpRequest

the request to execute

responseHandler:ResponseHandler<? extends T>

the response handler

context:HttpContext

the context to use for the execution, or null to use the default context

Returns:T

the response object as generated by the response handler.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public HttpResponse execute(final HttpUriRequest request) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context.

Parameters
request:HttpUriRequest

the request to execute

Returns:HttpResponse

the response to the request. This is always a final response, never an intermediate response with an 1xx status code. Whether redirects or authentication challenges will be returned or handled automatically depends on the implementation and configuration of this client.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public HttpResponse execute(final HttpUriRequest request, final HttpContext context) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context.

Parameters
request:HttpUriRequest

the request to execute

context:HttpContext

the context to use for the execution, or null to use the default context

Returns:HttpResponse

the response to the request. This is always a final response, never an intermediate response with an 1xx status code. Whether redirects or authentication challenges will be returned or handled automatically depends on the implementation and configuration of this client.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public <T> T execute(final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the default context and processes the response using the given response handler.

Implementing classes are required to ensure that the content entity associated with the response is fully consumed and the underlying connection is released back to the connection manager automatically in all cases relieving individual ResponseHandlers from having to manage resource deallocation internally.

Parameters
request:HttpUriRequest

the request to execute

responseHandler:ResponseHandler<? extends T>

the response handler

Returns:T

the response object as generated by the response handler.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public <T> T execute(final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context and processes the response using the given response handler.

Implementing classes are required to ensure that the content entity associated with the response is fully consumed and the underlying connection is released back to the connection manager automatically in all cases relieving individual ResponseHandlers from having to manage resource deallocation internally.

Parameters
request:HttpUriRequest

the request to execute

responseHandler:ResponseHandler<? extends T>

the response handler

context:HttpContext

the context to use for the execution, or null to use the default context

Returns:T

the response object as generated by the response handler.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
executeback to summary
public HttpResponse execute(final HttpHost target, final HttpRequest request, final HttpContext context) throws IOException

Implements org.apache.http.client.HttpClient.execute.

Doc from org.apache.http.client.HttpClient.execute.

Executes HTTP request using the given context.

Parameters
target:HttpHost

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:HttpRequest

the request to execute

context:HttpContext

the context to use for the execution, or null to use the default context

Returns:HttpResponse

the response to the request. This is always a final response, never an intermediate response with an 1xx status code. Whether redirects or authentication challenges will be returned or handled automatically depends on the implementation and configuration of this client.

Annotations
@Override
Exceptions
IOException:
in case of a problem or the connection was aborted
getConnectionManagerback to summary
public ClientConnectionManager getConnectionManager()

Implements org.apache.http.client.HttpClient.getConnectionManager.

Doc from org.apache.http.client.HttpClient.getConnectionManager.

Deprecated

as a consequence of ClientConnectionManager being deprecated. See corresponding docs for further information.

Obtains the connection manager used by this client.

Returns:ClientConnectionManager

the connection manager

Annotations
@Override
getParamsback to summary
public HttpParams getParams()

Implements org.apache.http.client.HttpClient.getParams.

Doc from org.apache.http.client.HttpClient.getParams.

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

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:HttpParams

the default parameters

Annotations
@Override