public interface ResponseHandlerInterface
| Modifier and Type | Method and Description |
|---|---|
cz.msebera.android.httpclient.Header[] |
getRequestHeaders()
Returns Header[] which were used to request
|
java.net.URI |
getRequestURI()
Returns URI which was used to request
|
java.lang.Object |
getTag()
Will retrieve TAG Object if it's not already freed from memory
|
boolean |
getUsePoolThread()
Returns whether the handler should be executed on the pool's thread
or the UI thread
|
boolean |
getUseSynchronousMode()
Returns whether the handler is asynchronous or synchronous
|
void |
onPostProcessResponse(ResponseHandlerInterface instance,
cz.msebera.android.httpclient.HttpResponse response)
This method is called once by the system when the request has been fully
sent, handled and finished.
|
void |
onPreProcessResponse(ResponseHandlerInterface instance,
cz.msebera.android.httpclient.HttpResponse response)
This method is called once by the system when the response is about to be
processed by the system.
|
void |
sendCancelMessage()
Notifies callback, that request was cancelled
|
void |
sendFailureMessage(int statusCode,
cz.msebera.android.httpclient.Header[] headers,
byte[] responseBody,
java.lang.Throwable error)
Returns if request was completed with error code or failure of implementation
|
void |
sendFinishMessage()
Notifies callback, that request was completed and is being removed from thread pool
|
void |
sendProgressMessage(long bytesWritten,
long bytesTotal)
Notifies callback, that request (mainly uploading) has progressed
|
void |
sendResponseMessage(cz.msebera.android.httpclient.HttpResponse response)
Returns data whether request completed successfully
|
void |
sendRetryMessage(int retryNo)
Notifies callback of retrying request
|
void |
sendStartMessage()
Notifies callback, that request started execution
|
void |
sendSuccessMessage(int statusCode,
cz.msebera.android.httpclient.Header[] headers,
byte[] responseBody)
Notifies callback, that request was handled successfully
|
void |
setRequestHeaders(cz.msebera.android.httpclient.Header[] requestHeaders)
Helper for handlers to receive Request Header[] info
|
void |
setRequestURI(java.net.URI requestURI)
Helper for handlers to receive Request URI info
|
void |
setTag(java.lang.Object TAG)
Will set TAG to ResponseHandlerInterface implementation, which can be then obtained
in implemented methods, such as onSuccess, onFailure, ...
|
void |
setUsePoolThread(boolean usePoolThread)
Sets whether the handler should be executed on the pool's thread or the
UI thread
|
void |
setUseSynchronousMode(boolean useSynchronousMode)
Can set, whether the handler should be asynchronous or synchronous
|
void sendResponseMessage(cz.msebera.android.httpclient.HttpResponse response)
throws java.io.IOException
response - HttpResponse object with datajava.io.IOException - if retrieving data from response failsvoid sendStartMessage()
void sendFinishMessage()
void sendProgressMessage(long bytesWritten,
long bytesTotal)
bytesWritten - number of written bytesbytesTotal - number of total bytes to be writtenvoid sendCancelMessage()
void sendSuccessMessage(int statusCode,
cz.msebera.android.httpclient.Header[] headers,
byte[] responseBody)
statusCode - HTTP status codeheaders - returned headersresponseBody - returned datavoid sendFailureMessage(int statusCode,
cz.msebera.android.httpclient.Header[] headers,
byte[] responseBody,
java.lang.Throwable error)
statusCode - returned HTTP status codeheaders - returned headersresponseBody - returned dataerror - cause of request failurevoid sendRetryMessage(int retryNo)
retryNo - number of retry within one requestjava.net.URI getRequestURI()
void setRequestURI(java.net.URI requestURI)
requestURI - claimed request URIcz.msebera.android.httpclient.Header[] getRequestHeaders()
void setRequestHeaders(cz.msebera.android.httpclient.Header[] requestHeaders)
requestHeaders - Headers, claimed to be from original requestboolean getUseSynchronousMode()
void setUseSynchronousMode(boolean useSynchronousMode)
useSynchronousMode - whether data should be handled on background Thread on UI Threadboolean getUsePoolThread()
void setUsePoolThread(boolean usePoolThread)
usePoolThread - if the ResponseHandler should run on pool's threadvoid onPreProcessResponse(ResponseHandlerInterface instance, cz.msebera.android.httpclient.HttpResponse response)
Please note: pre-processing does NOT run on the main thread, and thus any UI activities that you must perform should be properly dispatched to the app's UI thread.
instance - An instance of this response objectresponse - The response to pre-processedvoid onPostProcessResponse(ResponseHandlerInterface instance, cz.msebera.android.httpclient.HttpResponse response)
Please note: post-processing does NOT run on the main thread, and thus any UI activities that you must perform should be properly dispatched to the app's UI thread.
instance - An instance of this response objectresponse - The response to post-processjava.lang.Object getTag()
void setTag(java.lang.Object TAG)
TAG - Object to be set as TAG, will be placed in WeakReference