|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- Type of object returned by the Future.get()
public interface AsyncHandler<T>
An asynchronous handler or callback which gets invoked as soon as some data are available when
processing an asynchronous response. Callbacks method gets invoked in the following order:
(1) onStatusReceived(HttpResponseStatus)
(2) onHeadersReceived(HttpResponseHeaders)
(3) onBodyPartReceived(HttpResponseBodyPart)
, which could be invoked multiple times
(4) onCompleted()
, once the response has been fully read.
Interrupting the process of the asynchronous response can be achieved by
returning a AsyncHandler.STATE.ABORT
at any moment during the
processing of the asynchronous response.
Nested Class Summary | |
---|---|
static class |
AsyncHandler.STATE
|
Method Summary | |
---|---|
AsyncHandler.STATE |
onBodyPartReceived(HttpResponseBodyPart bodyPart)
Invoked as soon as some response body part are received. |
T |
onCompleted()
Invoked once the HTTP response has been fully received |
AsyncHandler.STATE |
onHeadersReceived(HttpResponseHeaders headers)
Invoked as soon as the HTTP headers has been received. |
AsyncHandler.STATE |
onStatusReceived(HttpResponseStatus responseStatus)
Invoked as soon as the HTTP status line has been received |
void |
onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response |
Method Detail |
---|
void onThrowable(Throwable t)
t
- a Throwable
AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception
bodyPart
- response's body part.
Exception
AsyncHandler.STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exception
responseStatus
- the status code and test of the response
Exception
AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception
headers
- the HTTP headers.
Exception
T onCompleted() throws Exception
Future
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |