T
- the type of the value determined by the response.@Contract(threading=STATELESS) public abstract class AbstractHttpClientResponseHandler<T> extends Object implements org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
HttpClientResponseHandler
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.hc.core5.http.ClassicHttpRequest, HttpClientResponseHandler)
,
HttpClient may handle redirects (3xx responses) internally.
Constructor and Description |
---|
AbstractHttpClientResponseHandler() |
Modifier and Type | Method and 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).
|
public T handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) throws IOException
HttpResponseException
.handleResponse
in interface org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
IOException
public abstract T handleEntity(org.apache.hc.core5.http.HttpEntity entity) throws IOException
IOException
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.