|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the result type of request processing.public interface HttpAsyncRequestConsumer<T>
HttpAsyncRequestConsumer
is a callback interface whose methods
get invoked to process an HTTP request message and to stream message
content from a non-blocking HTTP connection on the server side.
Method Summary | |
---|---|
void |
consumeContent(ContentDecoder decoder,
IOControl ioControl)
Invoked to process a chunk of content from the ContentDecoder . |
void |
failed(Exception ex)
Invoked to signal that the request processing terminated abnormally. |
Exception |
getException()
Returns an exception in case of an abnormal termination. |
T |
getResult()
Returns a result of the request execution, when available. |
boolean |
isDone()
Determines whether or not the request execution completed. |
void |
requestCompleted(HttpContext context)
Invoked to signal that the request has been fully processed. |
void |
requestReceived(HttpRequest request)
Invoked when a HTTP request message is received. |
Methods inherited from interface java.io.Closeable |
---|
close |
Method Detail |
---|
void requestReceived(HttpRequest request) throws HttpException, IOException
consumeContent(ContentDecoder, IOControl)
method
will be invoked only for if the request message implements
HttpEntityEnclosingRequest
interface and
has a content entity enclosed.
request
- HTTP request message.
HttpException
- in case of HTTP protocol violation
IOException
- in case of an I/O errorvoid consumeContent(ContentDecoder decoder, IOControl ioControl) throws IOException
ContentDecoder
.
The IOControl
interface can be used to suspend input event
notifications if the consumer is temporarily unable to process content.
The consumer can use the ContentDecoder.isCompleted()
method
to find out whether or not the message content has been fully consumed.
Please note that the ContentDecoder
object is not thread-safe and
should only be used within the context of this method call.
The IOControl
object can be shared and used on other thread
to resume input event notifications when the consumer is capable of
processing more content.
decoder
- content decoder.ioControl
- I/O control of the underlying connection.
IOException
- in case of an I/O errorvoid requestCompleted(HttpContext context)
context
- HTTP contextvoid failed(Exception ex)
ex
- exceptionException getException()
null
if the request execution is still ongoing
or if it completed successfully.
isDone()
T getResult()
null
if the request execution is still ongoing.
isDone()
boolean isDone()
getResult()
can be used to obtain the result. If the request processing terminated
abnormally getException()
can be used to obtain the cause.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |