T
- the result type of response processing.public interface HttpAsyncResponseConsumer<T> extends Closeable, Cancellable
Modifier and Type | Method and Description |
---|---|
void |
consumeContent(ContentDecoder decoder,
IOControl ioctrl)
Invoked to process a chunk of content from the
ContentDecoder . |
void |
failed(Exception ex)
Invoked to signal that the response processing terminated abnormally.
|
Exception |
getException()
Returns an exception in case of an abnormal termination.
|
T |
getResult()
Returns a result of the response processing, when available.
|
boolean |
isDone()
Determines whether or not the response processing completed.
|
void |
responseCompleted(HttpContext context)
Invoked to signal that the response has been fully processed.
|
void |
responseReceived(HttpResponse response)
Invoked when a HTTP response message is received.
|
cancel
void responseReceived(HttpResponse response) throws IOException, HttpException
consumeContent(ContentDecoder, IOControl)
method
will be invoked only if the response messages has a content entity
enclosed.response
- HTTP response message.HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O errorvoid consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException
ContentDecoder
.
The IOControl
interface can be used to suspend input events
if the consumer is temporarily unable to consume more content.
The consumer can use the ContentDecoder.isCompleted()
method
to find out whether or not the message content has been fully consumed.decoder
- content decoder.ioctrl
- I/O control of the underlying connection.IOException
- in case of an I/O errorvoid responseCompleted(HttpContext context)
context
- HTTP contextvoid failed(Exception ex)
ex
- exceptionException getException()
null
if the response processing is still ongoing
or if it completed successfully.isDone()
T getResult()
null
if the response processing is still ongoing.isDone()
boolean isDone()
getResult()
can be used to obtain the result. If the response processing terminated
abnormally getException()
can be used to obtain the cause.Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.