public class BasicHttpClientResponseHandler extends AbstractHttpClientResponseHandler<java.lang.String>
org.apache.hc.core5.http.io.HttpClientResponseHandler that returns
the response body as a String 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
org.apache.hc.client5.http.classic.HttpClient#execute(
org.apache.hc.core5.http.ClassicHttpRequest,
org.apache.hc.core5.http.io.HttpClientResponseHandler),
HttpClient may handle redirects (3xx responses) internally.
| Constructor and Description |
|---|
BasicHttpClientResponseHandler() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
handleEntity(HttpEntity entity)
Returns the entity as a body as a String.
|
java.lang.String |
handleResponse(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 java.lang.String handleEntity(HttpEntity entity)
throws java.io.IOException
handleEntity in class AbstractHttpClientResponseHandler<java.lang.String>java.io.IOExceptionpublic java.lang.String handleResponse(ClassicHttpResponse response)
throws java.io.IOException
AbstractHttpClientResponseHandlerHttpResponseException.handleResponse in class AbstractHttpClientResponseHandler<java.lang.String>java.io.IOException