public class BasicAsyncRequestConsumer extends AbstractAsyncRequestConsumer<HttpRequest>
HttpAsyncRequestConsumer. Please note that
this consumer buffers request content in memory and should be used for
relatively small request messages.| Modifier and Type | Field and Description |
|---|---|
private SimpleInputBuffer |
buf |
private static int |
MAX_INITIAL_BUFFER_SIZE |
private HttpRequest |
request |
| Constructor and Description |
|---|
BasicAsyncRequestConsumer() |
| Modifier and Type | Method and Description |
|---|---|
protected HttpRequest |
buildResult(HttpContext context)
Invoked to generate a result object from the received HTTP request
message.
|
protected void |
onContentReceived(ContentDecoder decoder,
IOControl ioctrl)
Invoked to process a chunk of content from the
ContentDecoder. |
protected void |
onEntityEnclosed(HttpEntity entity,
ContentType contentType)
Invoked if the request message encloses a content entity.
|
protected void |
onRequestReceived(HttpRequest request)
Invoked when a HTTP request message is received.
|
protected void |
releaseResources()
Invoked to release all system resources currently allocated.
|
close, consumeContent, failed, getException, getResult, isDone, onClose, requestCompleted, requestReceivedprivate static final int MAX_INITIAL_BUFFER_SIZE
private volatile HttpRequest request
private volatile SimpleInputBuffer buf
protected void onRequestReceived(HttpRequest request) throws java.io.IOException
AbstractAsyncRequestConsumerAbstractAsyncRequestConsumer.onContentReceived(ContentDecoder, IOControl) method
will be invoked only for if the request message implements
HttpEntityEnclosingRequest interface and has a content
entity enclosed.onRequestReceived in class AbstractAsyncRequestConsumer<HttpRequest>request - HTTP request message.java.io.IOException - in case of an I/O errorprotected void onEntityEnclosed(HttpEntity entity, ContentType contentType) throws java.io.IOException
AbstractAsyncRequestConsumeronEntityEnclosed in class AbstractAsyncRequestConsumer<HttpRequest>entity - HTTP entitycontentType - expected content type.java.io.IOException - in case of an I/O errorprotected void onContentReceived(ContentDecoder decoder, IOControl ioctrl) throws java.io.IOException
AbstractAsyncRequestConsumerContentDecoder.
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.
onContentReceived in class AbstractAsyncRequestConsumer<HttpRequest>decoder - content decoder.ioctrl - I/O control of the underlying connection.java.io.IOException - in case of an I/O errorprotected void releaseResources()
AbstractAsyncRequestConsumerreleaseResources in class AbstractAsyncRequestConsumer<HttpRequest>protected HttpRequest buildResult(HttpContext context)
AbstractAsyncRequestConsumerbuildResult in class AbstractAsyncRequestConsumer<HttpRequest>context - HTTP context.