public interface RestCallHandler
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.
PropertyStore
- The properties used to initialize the client.
The BasicRestCallHandler
shows an example of a simple pass-through handler. Note that you must handle
the case where HttpHost
is null.
Modifier and Type | Method and Description |
---|---|
HttpResponse |
run(HttpHost target,
HttpRequest request,
HttpContext context)
Execute the specified request.
|
HttpResponse run(HttpHost target, HttpRequest request, HttpContext context) throws ClientProtocolException, IOException
Subclasses can override this method to provide specialized handling.
target
- The target host for the request.
request
- The request to execute. Must be an instance of HttpUriRequest
if the target is context
- The context to use for the execution, or IOException
- In case of a problem or the connection was aborted.ClientProtocolException
- In case of an http protocol error.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.