Top Description Constructors Methods
org.apache.http.impl.client

public Class BasicResponseHandler

extends AbstractResponseHandler<String>
Class Inheritance
Annotations
@Contract
threading:IMMUTABLE
Imports
java.io.IOException, org.apache.http.HttpEntity, .HttpResponse, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.client.HttpResponseException, org.apache.http.util.EntityUtils

A org.apache.http.client.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 org.apache.http.client.HttpResponseException is thrown.

If this is used with org.apache.http.client.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

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
handleEntity(final HttpEntity entity)

Implements abstract org.apache.http.impl.client.AbstractResponseHandler.handleEntity.

Returns the entity as a body as a String.
public String
handleResponse(final HttpResponse
The response to process
response
)

Overrides org.apache.http.impl.client.AbstractResponseHandler.handleResponse.

Implements org.apache.http.client.ResponseHandler.handleResponse.

Read the entity from the response body and pass it to the entity handler method if the response was successful (a 2xx status code).

Constructor Detail

BasicResponseHandlerback to summary
public BasicResponseHandler()

Method Detail

handleEntityback to summary
public String handleEntity(final HttpEntity entity) throws IOException

Implements abstract org.apache.http.impl.client.AbstractResponseHandler.handleEntity.

Returns the entity as a body as a String.

Annotations
@Override
handleResponseback to summary
public String handleResponse(final HttpResponse response) throws HttpResponseException, IOException

Overrides org.apache.http.impl.client.AbstractResponseHandler.handleResponse.

Implements org.apache.http.client.ResponseHandler.handleResponse.

Doc from org.apache.http.impl.client.AbstractResponseHandler.handleResponse.

Read 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 an HttpResponseException.

Parameters
response:HttpResponse

Doc from org.apache.http.client.ResponseHandler.handleResponse.

The response to process

Returns:String

Doc from org.apache.http.client.ResponseHandler.handleResponse.

A value determined by the response

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.http.client.ResponseHandler.handleResponse.

in case of a problem or the connection was aborted