public interface ResponseHandlerInterface
| 限定符和类型 | 方法和说明 |
|---|---|
Header[] |
getRequestHeaders()
Returns Header[] which were used to request
|
java.net.URI |
getRequestURI()
Returns URI which was used to request
|
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,
HttpResponse response)
This method is called once by the system when the request has been fully
sent, handled and finished.
|
void |
onPreProcessResponse(ResponseHandlerInterface instance,
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,
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(int bytesWritten,
int bytesTotal)
Notifies callback, that request (mainly uploading) has progressed
|
void |
sendResponseMessage(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,
Header[] headers,
byte[] responseBody)
Notifies callback, that request was handled successfully
|
void |
setRequestHeaders(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 |
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(HttpResponse response)
throws java.io.IOException
response - HttpResponse object with datajava.io.IOException - if retrieving data from response failsvoid sendStartMessage()
void sendFinishMessage()
void sendProgressMessage(int bytesWritten,
int bytesTotal)
bytesWritten - number of written bytesbytesTotal - number of total bytes to be writtenvoid sendCancelMessage()
void sendSuccessMessage(int statusCode,
Header[] headers,
byte[] responseBody)
statusCode - HTTP status codeheaders - returned headersresponseBody - returned datavoid sendFailureMessage(int statusCode,
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()
Header[] getRequestHeaders()
void setRequestURI(java.net.URI requestURI)
requestURI - claimed request URIvoid setRequestHeaders(Header[] requestHeaders)
requestHeaders - Headers, claimed to be from original requestvoid setUseSynchronousMode(boolean useSynchronousMode)
useSynchronousMode - whether data should be handled on background Thread on UI Threadboolean getUseSynchronousMode()
void setUsePoolThread(boolean usePoolThread)
usePoolThread - if the ResponseHandler should run on pool's threadboolean getUsePoolThread()
void onPreProcessResponse(ResponseHandlerInterface instance, HttpResponse response)
instance - An instance of this response objectresponse - The response to pre-processedvoid onPostProcessResponse(ResponseHandlerInterface instance, HttpResponse response)
instance - An instance of this response objectresponse - The response to post-process