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.| 构造器和说明 |
|---|
BasicResponseConsumer(AsyncEntityConsumer<T> dataConsumer) |
BasicResponseConsumer(Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 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 在接口中 AsyncResponseConsumer<Message<HttpResponse,T>>response - the intermediate (1xx) HTTP response.httpContext - the actual execution context.HttpExceptionIOExceptionpublic void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity 在接口中 AsyncDataConsumercapacityChannel - the channel for capacity updates.IOExceptionpublic void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume 在接口中 AsyncDataConsumersrc - data source.IOExceptionpublic void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd 在接口中 AsyncDataConsumertrailers - data stream trailers.HttpExceptionIOExceptionpublic void failed(Exception cause)
AsyncResponseConsumerfailed 在接口中 AsyncResponseConsumer<Message<HttpResponse,T>>cause - the cause of the failure.public void releaseResources()
releaseResources 在接口中 ResourceHolderCopyright © 2023. All rights reserved.