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
AsyncResponseConsumer
consumeResponse
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.HttpException
IOException
public void informationResponse(HttpResponse response, HttpContext httpContext) throws HttpException, IOException
AsyncResponseConsumer
informationResponse
in interface AsyncResponseConsumer<Message<HttpResponse,T>>
response
- the intermediate (1xx) HTTP response.httpContext
- the actual execution context.HttpException
IOException
public void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumer
updateCapacity
in interface AsyncDataConsumer
capacityChannel
- the channel for capacity updates.IOException
public void consume(ByteBuffer src) throws IOException
AsyncDataConsumer
consume
in interface AsyncDataConsumer
src
- data source.IOException
public void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumer
streamEnd
in interface AsyncDataConsumer
trailers
- data stream trailers.HttpException
IOException
public void failed(Exception cause)
AsyncResponseConsumer
failed
in interface AsyncResponseConsumer<Message<HttpResponse,T>>
cause
- the cause of the failure.public void releaseResources()
releaseResources
in interface ResourceHolder
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.