public class BasicResponseHandler extends java.lang.Object implements ResponseHandler
ResponseHandler
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
HttpClient.execute(
org.apache.http.client.methods.HttpUriRequest, ResponseHandler)
,
HttpClient may handle redirects (3xx responses) internally.Constructor and Description |
---|
BasicResponseHandler() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
handleResponse(HttpResponse response)
Returns the response body as a String if the response was successful (a
2xx status code).
|
public java.lang.String handleResponse(HttpResponse response) throws HttpResponseException, java.io.IOException
HttpResponseException
.handleResponse
in interface ResponseHandler
response
- The response to processClientProtocolException
- in case of an http protocol errorjava.io.IOException
- in case of a problem or the connection was abortedHttpResponseException