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.| Constructor and Description | 
|---|
| BasicClientExchangeHandler(AsyncRequestProducer requestProducer,
                          AsyncResponseConsumer<T> responseConsumer,
                          FutureCallback<T> resultCallback) | 
| Modifier and Type | Method and Description | 
|---|---|
| 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 in interface AsyncClientExchangeHandlerrequestChannel - the request channel capable to accepting a request message.httpContext - the actual execution context.HttpExceptionIOExceptionpublic int available()
AsyncDataProduceravailable in interface AsyncDataProducerpublic void produce(DataStreamChannel channel) throws IOException
AsyncDataProducerproduce in interface AsyncDataProducerchannel - the data channel capable to accepting more data.IOExceptionpublic void consumeInformation(HttpResponse response, HttpContext httpContext) throws HttpException, IOException
AsyncClientExchangeHandlerconsumeInformation in interface AsyncClientExchangeHandlerresponse - the intermediate (1xx) HTTP response.httpContext - the actual execution context.HttpExceptionIOExceptionpublic void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException
AsyncClientExchangeHandlerconsumeResponse in interface 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 in interface AsyncClientExchangeHandlerpublic 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)
AsyncDataExchangeHandlerfailed in interface AsyncDataExchangeHandlercause - the cause of the failure.public void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.