@Contract(threading=SAFE) public final class ReactiveResponseConsumer extends Object implements AsyncResponseConsumer<Void>
AsyncResponseConsumer that publishes the response body through
a Publisher, as defined by the Reactive Streams specification. The
response is represented as a Message consisting of a HttpResponse representing the headers and a Publisher representing
the response body as an asynchronous stream of ByteBuffer instances.| Constructor and Description |
|---|
ReactiveResponseConsumer()
Creates a
ReactiveResponseConsumer. |
ReactiveResponseConsumer(FutureCallback<Message<HttpResponse,org.reactivestreams.Publisher<ByteBuffer>>> responseCallback)
Creates a
ReactiveResponseConsumer that will call back the supplied FutureCallback with a
streamable response. |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(ByteBuffer src) |
void |
consumeResponse(HttpResponse response,
EntityDetails entityDetails,
HttpContext httpContext,
FutureCallback<Void> resultCallback) |
void |
failed(Exception cause) |
EntityDetails |
getEntityDetails()
Returns the response entity details.
|
HttpResponse |
getInformationResponse()
Returns the intermediate (1xx) HTTP response if one was received.
|
Future<Message<HttpResponse,org.reactivestreams.Publisher<ByteBuffer>>> |
getResponseFuture() |
List<Header> |
getTrailers()
Returns the trailers received at the end of the response.
|
void |
informationResponse(HttpResponse response,
HttpContext httpContext) |
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers) |
void |
updateCapacity(CapacityChannel capacityChannel) |
public ReactiveResponseConsumer()
ReactiveResponseConsumer.public ReactiveResponseConsumer(FutureCallback<Message<HttpResponse,org.reactivestreams.Publisher<ByteBuffer>>> responseCallback)
ReactiveResponseConsumer that will call back the supplied FutureCallback with a
streamable response.responseCallback - the callback to invoke when the response is available for consumption.public Future<Message<HttpResponse,org.reactivestreams.Publisher<ByteBuffer>>> getResponseFuture()
public HttpResponse getInformationResponse()
null if none.public EntityDetails getEntityDetails()
null if none.public List<Header> getTrailers()
public void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext, FutureCallback<Void> resultCallback)
consumeResponse in interface AsyncResponseConsumer<Void>public void informationResponse(HttpResponse response, HttpContext httpContext)
informationResponse in interface AsyncResponseConsumer<Void>public void failed(Exception cause)
failed in interface AsyncResponseConsumer<Void>public void updateCapacity(CapacityChannel capacityChannel) throws IOException
updateCapacity in interface AsyncDataConsumerIOExceptionpublic void consume(ByteBuffer src) throws IOException
consume in interface AsyncDataConsumerIOExceptionpublic void streamEnd(List<? extends Header> trailers)
streamEnd in interface AsyncDataConsumerpublic void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.