@Contract(threading=IMMUTABLE) public abstract class AbstractResponseHandler<T> extends Object implements ResponseHandler<T>
ResponseHandler that works with the response entity
for successful (2xx) responses. If the response code was >= 300, the response
body is consumed and an HttpResponseException is thrown.
If this is used with
HttpClient.execute(
org.apache.http.client.methods.HttpUriRequest, ResponseHandler),
HttpClient may handle redirects (3xx responses) internally.
| Constructor and Description |
|---|
AbstractResponseHandler() |
| Modifier and Type | Method and Description |
|---|---|
abstract T |
handleEntity(HttpEntity entity)
Handle the response entity and transform it into the actual response
object.
|
T |
handleResponse(HttpResponse response)
Read the entity from the response body and pass it to the entity handler
method if the response was successful (a 2xx status code).
|
public T handleResponse(HttpResponse response) throws HttpResponseException, IOException
HttpResponseException.handleResponse in interface ResponseHandler<T>response - The response to processClientProtocolException - in case of an http protocol errorIOException - in case of a problem or the connection was abortedHttpResponseExceptionpublic abstract T handleEntity(HttpEntity entity) throws IOException
IOExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved