public final class BasicClientExchangeHandler<T> extends Object implements AsyncClientExchangeHandler
AsyncClientExchangeHandler implementation that makes use
of AsyncRequestProducer to generate request message
and AsyncResponseConsumer to process the response message returned by the server.| 构造器和说明 |
|---|
BasicClientExchangeHandler(AsyncRequestProducer requestProducer,
AsyncResponseConsumer<T> responseConsumer,
FutureCallback<T> resultCallback) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
available()
Returns the number of bytes immediately available for output.
|
void |
cancel()
Triggered to cancel the message exchange.
|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
void |
consumeInformation(HttpResponse response,
HttpContext httpContext)
Triggered to signal receipt of an intermediate (1xx) HTTP response.
|
void |
consumeResponse(HttpResponse response,
EntityDetails entityDetails,
HttpContext httpContext)
Triggered to signal receipt of a response message head.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
void |
produce(DataStreamChannel channel)
Triggered to signal the ability of the underlying data channel
to accept more data.
|
void |
produceRequest(RequestChannel requestChannel,
HttpContext httpContext)
Triggered to signal the ability of the underlying request channel
to accept a request messages.
|
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 BasicClientExchangeHandler(AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, FutureCallback<T> resultCallback)
public void produceRequest(RequestChannel requestChannel, HttpContext httpContext) throws HttpException, IOException
AsyncClientExchangeHandlerproduceRequest 在接口中 AsyncClientExchangeHandlerrequestChannel - the request channel capable to accepting a request message.httpContext - the actual execution context.HttpExceptionIOExceptionpublic int available()
AsyncDataProduceravailable 在接口中 AsyncDataProducerpublic void produce(DataStreamChannel channel) throws IOException
AsyncDataProducerproduce 在接口中 AsyncDataProducerchannel - the data channel capable to accepting more data.IOExceptionpublic void consumeInformation(HttpResponse response, HttpContext httpContext) throws HttpException, IOException
AsyncClientExchangeHandlerconsumeInformation 在接口中 AsyncClientExchangeHandlerresponse - the intermediate (1xx) HTTP response.httpContext - the actual execution context.HttpExceptionIOExceptionpublic void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException
AsyncClientExchangeHandlerconsumeResponse 在接口中 AsyncClientExchangeHandlerresponse - the response message head.entityDetails - the response entity details or null if the response
does not enclose an entity.httpContext - the actual execution context.HttpExceptionIOExceptionpublic void cancel()
AsyncClientExchangeHandlercancel 在接口中 AsyncClientExchangeHandlerpublic 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)
AsyncDataExchangeHandlerfailed 在接口中 AsyncDataExchangeHandlercause - the cause of the failure.public void releaseResources()
releaseResources 在接口中 ResourceHolderCopyright © 2023. All rights reserved.