@Experimental public class ClassicToAsyncServerExchangeHandler extends Object implements AsyncServerExchangeHandler
AsyncServerExchangeHandler implementation that acts as a compatibility
layer for classic InputStream / OutputStream based interfaces.
Blocking input / output processing is executed through an Executor.| Constructor and Description |
|---|
ClassicToAsyncServerExchangeHandler(Executor executor,
HttpRequestHandler handler,
Callback<Exception> exceptionCallback) |
ClassicToAsyncServerExchangeHandler(Executor executor,
HttpRequestMapper<HttpRequestHandler> handlerMapper,
Callback<Exception> exceptionCallback) |
ClassicToAsyncServerExchangeHandler(Executor executor,
HttpServerRequestHandler requestHandler,
Callback<Exception> exceptionCallback) |
ClassicToAsyncServerExchangeHandler(int initialBufferSize,
Executor executor,
HttpServerRequestHandler requestHandler,
Callback<Exception> exceptionCallback) |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the number of bytes immediately available for output.
|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
protected AsyncResponseProducer |
handleError(Exception ex) |
void |
handleRequest(HttpRequest request,
EntityDetails entityDetails,
ResponseChannel responseChannel,
HttpContext context)
Processes the actual HTTP request.
|
void |
produce(DataStreamChannel channel)
Triggered to signal the ability of the underlying data channel
to accept more data.
|
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 ClassicToAsyncServerExchangeHandler(int initialBufferSize,
Executor executor,
HttpServerRequestHandler requestHandler,
Callback<Exception> exceptionCallback)
public ClassicToAsyncServerExchangeHandler(Executor executor, HttpServerRequestHandler requestHandler, Callback<Exception> exceptionCallback)
public ClassicToAsyncServerExchangeHandler(Executor executor, HttpRequestMapper<HttpRequestHandler> handlerMapper, Callback<Exception> exceptionCallback)
public ClassicToAsyncServerExchangeHandler(Executor executor, HttpRequestHandler handler, Callback<Exception> exceptionCallback)
public final void handleRequest(HttpRequest request, EntityDetails entityDetails, ResponseChannel responseChannel, HttpContext context) throws HttpException, IOException
AsyncServerExchangeHandlerhandleRequest in interface AsyncServerExchangeHandlerrequest - the actual request.entityDetails - the request entity details or null if the request
does not enclose an entity.responseChannel - the response channel.context - the actual execution context.HttpException - in case of an HTTP protocol violation.IOException - in case of an I/O error.protected AsyncResponseProducer handleError(Exception ex)
public final void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity in interface AsyncDataConsumercapacityChannel - the channel for capacity updates.IOException - in case of an I/O error.public final void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume in interface AsyncDataConsumersrc - data source.IOException - in case of an I/O error.public final void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd in interface AsyncDataConsumertrailers - data stream trailers.HttpException - in case of an HTTP protocol violation.IOException - in case of an I/O error.public final int available()
AsyncDataProducer
Please note this method should return zero if the data producer
is unable to produce any more data, in which case
AsyncDataProducer.produce(DataStreamChannel) method will not get triggered.
The producer can resume writing out data asynchronously
once more data becomes available or request output readiness events
with DataStreamChannel.requestOutput().
available in interface AsyncDataProducerAsyncDataProducer.produce(DataStreamChannel),
DataStreamChannel.requestOutput()public final void produce(DataStreamChannel channel) throws IOException
AsyncDataProducer
Please note this method gets triggered only if AsyncDataProducer.available()
returns a positive value.
produce in interface AsyncDataProducerchannel - the data channel capable of accepting more data.IOException - in case of an I/O error.AsyncDataProducer.available()public final void failed(Exception cause)
AsyncDataExchangeHandlerfailed in interface AsyncDataExchangeHandlercause - the cause of the failure.public void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.