@Immutable public class BasicResponseHandler extends Object implements ResponseHandler<String>
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 |
|---|---|
String |
handleResponse(HttpResponse response)
Returns the response body as a String if the response was successful (a
2xx status code).
|
public String handleResponse(HttpResponse response) throws HttpResponseException, IOException
HttpResponseException.handleResponse in interface ResponseHandler<String>response - The response to processClientProtocolException - in case of an http protocol errorIOException - in case of a problem or the connection was abortedHttpResponseExceptionCopyright © 1999–2013 The Apache Software Foundation. All rights reserved.