public abstract class AbstractServerExchangeHandler<T> extends Object implements AsyncServerExchangeHandler
| 构造器和说明 |
|---|
AbstractServerExchangeHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
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 abstract void |
handle(T requestMessage,
AsyncServerRequestHandler.ResponseTrigger responseTrigger,
HttpContext context)
Triggered to handles the request object produced by the
AsyncRequestConsumer returned
from the supplyConsumer(HttpRequest, EntityDetails, HttpContext) method. |
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.
|
protected abstract AsyncRequestConsumer<T> |
supplyConsumer(HttpRequest request,
EntityDetails entityDetails,
HttpContext context)
Triggered to supply a request consumer to process the incoming request.
|
void |
updateCapacity(CapacityChannel capacityChannel)
Triggered to signal ability of the underlying data stream to receive
data capacity update.
|
protected abstract AsyncRequestConsumer<T> supplyConsumer(HttpRequest request, EntityDetails entityDetails, HttpContext context) throws HttpException
request - the request message.entityDetails - the request entity details.context - the actual execution context.HttpExceptionprotected abstract void handle(T requestMessage, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context) throws HttpException, IOException
AsyncRequestConsumer returned
from the supplyConsumer(HttpRequest, EntityDetails, HttpContext) method. The handler
can choose to send response messages immediately inside the call or asynchronously
at some later point.requestMessage - the request message.responseTrigger - the response trigger.context - the actual execution context.HttpExceptionIOExceptionpublic final void handleRequest(HttpRequest request, EntityDetails entityDetails, ResponseChannel responseChannel, HttpContext context) throws HttpException, IOException
AsyncServerExchangeHandlerhandleRequest 在接口中 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.HttpExceptionIOExceptionpublic final void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity 在接口中 AsyncDataConsumercapacityChannel - the channel for capacity updates.IOExceptionpublic final void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume 在接口中 AsyncDataConsumersrc - data source.IOExceptionpublic final void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd 在接口中 AsyncDataConsumertrailers - data stream trailers.HttpExceptionIOExceptionpublic final int available()
AsyncDataProduceravailable 在接口中 AsyncDataProducerpublic final void produce(DataStreamChannel channel) throws IOException
AsyncDataProducerproduce 在接口中 AsyncDataProducerchannel - the data channel capable to accepting more data.IOExceptionpublic final void failed(Exception cause)
AsyncDataExchangeHandlerfailed 在接口中 AsyncDataExchangeHandlercause - the cause of the failure.public final void releaseResources()
releaseResources 在接口中 ResourceHolderCopyright © 2023. All rights reserved.