Android Client SDK
com.verivo.akula.http.handler.AKTextHttpResponseHandler Class Reference

The AKTextHttpResponseHandler class defines an HTTP response handler that automatically checks the HTTP response code and, if successful, returns the response body as a String. More...

Inheritance diagram for com.verivo.akula.http.handler.AKTextHttpResponseHandler:
Inheritance graph

Public Member Functions

 AKTextHttpResponseHandler ()
 Create a new AKTextHttpResponseHandler. More...
 
void handleDone ()
 Handler classes implement this method to be handle when all response processing is complete. More...
 
void handleFailure (Throwable e)
 Handler classes implement this method to handle a local exception from a request. More...
 
void handleResponse (HttpResponse response)
 Handler classes implement this method to handle a returned HttpResponse from a request. More...
 
void onFailure (Throwable e)
 Override to handle a failed response. More...
 
void onFailure (Throwable e, String responseText)
 Override to handle a failed response that returns a String as its response data. More...
 
void onSuccess (String responseText)
 Override to handle a String response. More...
 
void onSuccess (String responseText, int statusCode)
 Override to handle a String response along with the HTTP response status code. More...
 
- Public Member Functions inherited from com.verivo.akula.http.handler.AKBaseHttpResponseHandler
void onDone ()
 Internal class used to carry response data from the background thread to the calling thread. More...
 

Protected Member Functions

void handleMessage (Message msg)
 Handle a message on the calling thread. More...
 
void processDone ()
 Perform any final processing on the background thread before sending a done message to the calling thread (if applicable). More...
 
void processFailure (Throwable e, String responseText)
 Process the error on the background thread, and send a failure message to the calling thread (if applicable). More...
 
void processResponse (HttpResponse response)
 Process the HTTP response on the background thread, parsing out the response text and checking the HTTP status code to determine whether the response was successful or not. More...
 
void processSuccess (String responseText, int statusCode)
 Process the response text on the background thread and send a success message to the calling thread (if applicable). More...
 
- Protected Member Functions inherited from com.verivo.akula.http.handler.AKBaseHttpResponseHandler
 AKBaseHttpResponseHandler ()
 Constructor. More...
 
boolean isSuccessfulHttpResponse (HttpResponse response)
 Determine if this HttpResponse object represents a successful request. More...
 
Message obtainMessage (int what, Object data)
 Create a new message to pass to the calling thread, if possible. More...
 
void sendMessage (Message msg)
 Send a message to the calling thread, if possible. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from com.verivo.akula.http.handler.AKBaseHttpResponseHandler
static final int RESPONSE_FAIL = -1
 Static constant representing a response failure status. More...
 
static final int RESPONSE_FINISH = 0
 Static constant representing a response completion status. More...
 
static final int RESPONSE_SUCCESS = 1
 Static constant representing a response success status. More...
 

Detailed Description

The AKTextHttpResponseHandler class defines an HTTP response handler that automatically checks the HTTP response code and, if successful, returns the response body as a String.

See Also
AKHttpAgent

Constructor & Destructor Documentation

com.verivo.akula.http.handler.AKTextHttpResponseHandler.AKTextHttpResponseHandler ( )

Create a new AKTextHttpResponseHandler.

Override onSuccess, onFailure, and onDone methods to handle response data.

Version
1.0

Member Function Documentation

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.handleDone ( )

Handler classes implement this method to be handle when all response processing is complete.

This method should be called after all other callback methods have completed.

Version
1.0

Implements com.verivo.akula.http.handler.AKHttpResponseHandler.

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.handleFailure ( Throwable  e)

Handler classes implement this method to handle a local exception from a request.

Version
1.0

Implements com.verivo.akula.http.handler.AKHttpResponseHandler.

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.handleMessage ( Message  msg)
protectedvirtual

Handle a message on the calling thread.

Parameters
msgThe Message object representing the message.
Version
1.0

Implements com.verivo.akula.http.handler.AKBaseHttpResponseHandler.

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.handleResponse ( HttpResponse  response)

Handler classes implement this method to handle a returned HttpResponse from a request.

Parameters
response
  • the unparsed response from the server.
Version
1.0

Implements com.verivo.akula.http.handler.AKHttpResponseHandler.

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.onFailure ( Throwable  e)

Override to handle a failed response.

Parameters
eThe exception causing the failure.
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.onFailure ( Throwable  e,
String  responseText 
)

Override to handle a failed response that returns a String as its response data.

Parameters
eThe exception causing the failure.
responseText
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.onSuccess ( String  responseText)

Override to handle a String response.

Note: If the HTTP response is successful, but the response data is null, this method is called with a null value.

Parameters
responseTextThe response string.
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.onSuccess ( String  responseText,
int  statusCode 
)

Override to handle a String response along with the HTTP response status code.

If not overridden, call onSuccess(String).

Note: If the HTTP response is successful, but the response data is null, this will be called with a null value.

Parameters
responseText
statusCode
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.processDone ( )
protectedvirtual

Perform any final processing on the background thread before sending a done message to the calling thread (if applicable).

Implements com.verivo.akula.http.handler.AKBaseHttpResponseHandler.

void com.verivo.akula.http.handler.AKTextHttpResponseHandler.processFailure ( Throwable  e,
String  responseText 
)
protected

Process the error on the background thread, and send a failure message to the calling thread (if applicable).

Parameters
eThe exception causing the failure.
responseText
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.processResponse ( HttpResponse  response)
protected

Process the HTTP response on the background thread, parsing out the response text and checking the HTTP status code to determine whether the response was successful or not.

Parameters
response
Version
1.0
void com.verivo.akula.http.handler.AKTextHttpResponseHandler.processSuccess ( String  responseText,
int  statusCode 
)
protected

Process the response text on the background thread and send a success message to the calling thread (if applicable).

Parameters
responseText
statusCode
Version
1.0