public final class ImmediateResponseExchangeHandler extends Object implements AsyncServerExchangeHandler
AsyncServerExchangeHandler
implementation that immediately responds
with a predefined response generated by a AsyncResponseProducer
and
ignores any entity content enclosed in the request message.Constructor and Description |
---|
ImmediateResponseExchangeHandler(AsyncResponseProducer responseProducer) |
ImmediateResponseExchangeHandler(HttpResponse response,
String message) |
ImmediateResponseExchangeHandler(int status,
String message) |
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.
|
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 ImmediateResponseExchangeHandler(AsyncResponseProducer responseProducer)
public ImmediateResponseExchangeHandler(HttpResponse response, String message)
public ImmediateResponseExchangeHandler(int status, String message)
public void handleRequest(HttpRequest request, EntityDetails entityDetails, ResponseChannel responseChannel, HttpContext context) throws HttpException, IOException
AsyncServerExchangeHandler
handleRequest
in interface AsyncServerExchangeHandler
request
- 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
IOException
public void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumer
updateCapacity
in interface AsyncDataConsumer
capacityChannel
- the channel for capacity updates.IOException
public void consume(ByteBuffer src) throws IOException
AsyncDataConsumer
consume
in interface AsyncDataConsumer
src
- data source.IOException
public void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumer
streamEnd
in interface AsyncDataConsumer
trailers
- data stream trailers.HttpException
IOException
public int available()
AsyncDataProducer
available
in interface AsyncDataProducer
public void produce(DataStreamChannel channel) throws IOException
AsyncDataProducer
produce
in interface AsyncDataProducer
channel
- the data channel capable to accepting more data.IOException
public void failed(Exception cause)
AsyncDataExchangeHandler
failed
in interface AsyncDataExchangeHandler
cause
- the cause of the failure.public void releaseResources()
releaseResources
in interface ResourceHolder
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.