Class AbstractHttpClientResponseHandler<T>
- java.lang.Object
-
- org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
-
- All Implemented Interfaces:
org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
- Direct Known Subclasses:
BasicHttpClientResponseHandler
,ContentResponseHandler
@Contract(threading=STATELESS) public abstract class AbstractHttpClientResponseHandler<T> extends java.lang.Object implements org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
A genericHttpClientResponseHandler
that works with the response entity for successful (2xx) responses. If the response code was >= 300, the response body is consumed and anHttpResponseException
is thrown.If this is used with
HttpClient.execute( org.apache.hc.core5.http.ClassicHttpRequest, HttpClientResponseHandler)
, HttpClient may handle redirects (3xx responses) internally.- Since:
- 4.4
-
-
Constructor Summary
Constructors Constructor Description AbstractHttpClientResponseHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
handleEntity(org.apache.hc.core5.http.HttpEntity entity)
Handle the response entity and transform it into the actual response object.T
handleResponse(org.apache.hc.core5.http.ClassicHttpResponse 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).
-
-
-
Method Detail
-
handleResponse
public T handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) throws java.io.IOException
Read the entity from the response body and pass it to the entity handler method if the response was successful (a 2xx status code). If no response body exists, this returns null. If the response was unsuccessful (>= 300 status code), throws anHttpResponseException
.- Specified by:
handleResponse
in interfaceorg.apache.hc.core5.http.io.HttpClientResponseHandler<T>
- Throws:
java.io.IOException
-
handleEntity
public abstract T handleEntity(org.apache.hc.core5.http.HttpEntity entity) throws java.io.IOException
Handle the response entity and transform it into the actual response object.- Throws:
java.io.IOException
-
-