Package org.apache.http.impl.client
Class BasicResponseHandler
- java.lang.Object
 - 
- org.apache.http.impl.client.AbstractResponseHandler<java.lang.String>
 - 
- org.apache.http.impl.client.BasicResponseHandler
 
 
 
- 
- All Implemented Interfaces:
 ResponseHandler<java.lang.String>
@Contract(threading=IMMUTABLE) public class BasicResponseHandler extends AbstractResponseHandler<java.lang.String>
AResponseHandlerthat returns the response body as a String for successful (2xx) responses. If the response code was >= 300, the response body is consumed and anHttpResponseExceptionis thrown.If this is used with
HttpClient.execute( org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler), HttpClient may handle redirects (3xx responses) internally.- Since:
 - 4.0
 
 
- 
- 
Constructor Summary
Constructors Constructor Description BasicResponseHandler() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringhandleEntity(HttpEntity entity)Returns the entity as a body as a String.java.lang.StringhandleResponse(HttpResponse 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
- 
handleEntity
public java.lang.String handleEntity(HttpEntity entity) throws java.io.IOException
Returns the entity as a body as a String.- Specified by:
 handleEntityin classAbstractResponseHandler<java.lang.String>- Throws:
 java.io.IOException
 
- 
handleResponse
public java.lang.String handleResponse(HttpResponse response) throws HttpResponseException, java.io.IOException
Description copied from class:AbstractResponseHandlerRead 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:
 handleResponsein interfaceResponseHandler<java.lang.String>- Overrides:
 handleResponsein classAbstractResponseHandler<java.lang.String>- Parameters:
 response- The response to process- Returns:
 - A value determined by the response
 - Throws:
 ClientProtocolException- in case of an http protocol errorjava.io.IOException- in case of a problem or the connection was abortedHttpResponseException
 
 - 
 
 -