public class BasicResponseConsumer<T> extends Object implements AsyncResponseConsumer<Message<HttpResponse,T>>
AsyncResponseConsumer that represents response message as
a Message and relies on a AsyncEntityConsumer to process response entity
stream.| Constructor and Description |
|---|
BasicResponseConsumer(AsyncEntityConsumer<T> dataConsumer) |
BasicResponseConsumer(Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
void |
consumeResponse(HttpResponse response,
EntityDetails entityDetails,
HttpContext httpContext,
FutureCallback<Message<HttpResponse,T>> resultCallback)
Triggered to signal receipt of a response message head.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
void |
informationResponse(HttpResponse response,
HttpContext httpContext)
Triggered to signal receipt of an intermediate (1xx) HTTP response.
|
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers)
Triggered to signal termination of the data stream.
|
void |
updateCapacity(CapacityChannel capacityChannel)
Triggered to signal ability of the underlying data stream to receive
data capacity update.
|
public BasicResponseConsumer(Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier)
public BasicResponseConsumer(AsyncEntityConsumer<T> dataConsumer)
public void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext, FutureCallback<Message<HttpResponse,T>> resultCallback) throws HttpException, IOException
AsyncResponseConsumerconsumeResponse in interface AsyncResponseConsumer<Message<HttpResponse,T>>response - the response message head.entityDetails - the response entity details or null if the response
does not enclose an entity.httpContext - the actual execution context.resultCallback - the result callback called when response processing
has been completed successfully or unsuccessfully.HttpExceptionIOExceptionpublic void informationResponse(HttpResponse response, HttpContext httpContext) throws HttpException, IOException
AsyncResponseConsumerinformationResponse in interface AsyncResponseConsumer<Message<HttpResponse,T>>response - the intermediate (1xx) HTTP response.httpContext - the actual execution context.HttpExceptionIOExceptionpublic void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity in interface AsyncDataConsumercapacityChannel - the channel for capacity updates.IOExceptionpublic void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume in interface AsyncDataConsumersrc - data source.IOExceptionpublic void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd in interface AsyncDataConsumertrailers - data stream trailers.HttpExceptionIOExceptionpublic void failed(Exception cause)
AsyncResponseConsumerfailed in interface AsyncResponseConsumer<Message<HttpResponse,T>>cause - the cause of the failure.public void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.