public class BasicAsyncResponseConsumer extends AbstractAsyncResponseConsumer<HttpResponse>
HttpAsyncResponseConsumer
. Please note that
this consumer buffers response content in memory and should be used for
relatively small response messages.Constructor and Description |
---|
BasicAsyncResponseConsumer() |
Modifier and Type | Method and Description |
---|---|
protected HttpResponse |
buildResult(HttpContext context)
Invoked to generate a result object from the received HTTP response
message.
|
protected void |
onContentReceived(ContentDecoder decoder,
IOControl ioControl)
Invoked to process a chunk of content from the
ContentDecoder . |
protected void |
onEntityEnclosed(HttpEntity entity,
ContentType contentType)
Invoked if the response message encloses a content entity.
|
protected void |
onResponseReceived(HttpResponse response)
Invoked when a HTTP response message is received.
|
protected void |
releaseResources()
Invoked to release all system resources currently allocated.
|
cancel, close, consumeContent, failed, getContentType, getException, getResult, isDone, onClose, responseCompleted, responseReceived
protected void onResponseReceived(HttpResponse response) throws IOException
AbstractAsyncResponseConsumer
AbstractAsyncResponseConsumer.onContentReceived(ContentDecoder, IOControl)
method
will be invoked only if the response messages has a content entity
enclosed.onResponseReceived
in class AbstractAsyncResponseConsumer<HttpResponse>
response
- HTTP response message.IOException
- in case of an I/O errorprotected void onEntityEnclosed(HttpEntity entity, ContentType contentType) throws IOException
AbstractAsyncResponseConsumer
onEntityEnclosed
in class AbstractAsyncResponseConsumer<HttpResponse>
entity
- HTTP entitycontentType
- expected content type.IOException
- in case of an I/O errorprotected void onContentReceived(ContentDecoder decoder, IOControl ioControl) throws IOException
AbstractAsyncResponseConsumer
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.
onContentReceived
in class AbstractAsyncResponseConsumer<HttpResponse>
decoder
- content decoder.ioControl
- I/O control of the underlying connection.IOException
- in case of an I/O errorprotected void releaseResources()
AbstractAsyncResponseConsumer
releaseResources
in class AbstractAsyncResponseConsumer<HttpResponse>
protected HttpResponse buildResult(HttpContext context)
AbstractAsyncResponseConsumer
buildResult
in class AbstractAsyncResponseConsumer<HttpResponse>
context
- HTTP context.Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.