Interface RestCallHandler
- All Known Implementing Classes:
BasicRestCallHandler
Providing this implementation is the equivalent to overriding the RestClient.execute(HttpHost,HttpRequest,HttpContext)
.
This can also be accomplished by providing your own connection manager
or subclassing RestClient
, but this provides a simpler way of handling the requests yourself.
The constructor on the implementation class can optionally take in any of the following parameters:
RestClient
- The client using this handler.
The BasicRestCallHandler
shows an example of a simple pass-through handler. Note that you must handle
the case where HttpHost
is null.
See Also:
-
Method Summary
Modifier and TypeMethodDescriptionrun
(HttpHost target, HttpRequest request, HttpContext context) Execute the specified request.
-
Method Details
-
run
HttpResponse run(HttpHost target, HttpRequest request, HttpContext context) throws ClientProtocolException, IOException Execute the specified request.Subclasses can override this method to provide specialized handling.
- Parameters:
target
- The target host for the request.
Implementations may acceptnull if they can still determine a route, for example to a default target or by inspecting the request.request
- The request to execute. Must be an instance ofHttpUriRequest
if the target isnull .context
- The context to use for the execution, ornull to use the default context.- Returns:
- 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. - Throws:
IOException
- In case of a problem or the connection was aborted.ClientProtocolException
- In case of an http protocol error.
-