class HttpAsyncService.HttpAsyncExchangeImpl extends java.lang.Object implements HttpAsyncExchange
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicBoolean |
completed |
private NHttpServerConnection |
conn |
private HttpContext |
context |
private HttpRequest |
request |
private HttpResponse |
response |
private HttpAsyncService.State |
state |
| Constructor and Description |
|---|
HttpAsyncExchangeImpl(HttpRequest request,
HttpResponse response,
HttpAsyncService.State state,
NHttpServerConnection conn,
HttpContext context) |
| Modifier and Type | Method and Description |
|---|---|
HttpRequest |
getRequest()
Returns the received HTTP request message.
|
HttpResponse |
getResponse()
Returns the default HTTP response message.
|
int |
getTimeout()
Returns timeout for this message exchange.
|
boolean |
isCompleted()
Determines whether or not the message exchange has been completed.
|
void |
setCallback(Cancellable cancellable)
Sets
Cancellable callback to be invoked in case the underlying
connection times out or gets terminated prematurely by the client. |
void |
setTimeout(int timeout)
Sets timeout for this message exchange.
|
void |
submitResponse()
Submits the default HTTP response and completed the message exchange.
|
void |
submitResponse(HttpAsyncResponseProducer responseProducer)
Submits an HTTP response using a custom
HttpAsyncResponseProducer. |
private final java.util.concurrent.atomic.AtomicBoolean completed
private final HttpRequest request
private final HttpResponse response
private final HttpAsyncService.State state
private final NHttpServerConnection conn
private final HttpContext context
public HttpAsyncExchangeImpl(HttpRequest request, HttpResponse response, HttpAsyncService.State state, NHttpServerConnection conn, HttpContext context)
public HttpRequest getRequest()
HttpAsyncExchangegetRequest in interface HttpAsyncExchangepublic HttpResponse getResponse()
HttpAsyncExchangeHttpAsyncExchange.submitResponse() method.getResponse in interface HttpAsyncExchangepublic void setCallback(Cancellable cancellable)
HttpAsyncExchangeCancellable callback to be invoked in case the underlying
connection times out or gets terminated prematurely by the client. This
callback can be used to cancel a long running response generating
process if a response is no longer needed.setCallback in interface HttpAsyncExchangepublic void submitResponse(HttpAsyncResponseProducer responseProducer)
HttpAsyncExchangeHttpAsyncResponseProducer.submitResponse in interface HttpAsyncExchangepublic void submitResponse()
HttpAsyncExchangeHttpEntity instance
the entity is also expected to implement the
HttpAsyncContentProducer
interface for efficient content streaming to a non-blocking HTTP
connection.submitResponse in interface HttpAsyncExchangepublic boolean isCompleted()
HttpAsyncExchangeisCompleted in interface HttpAsyncExchangetrue if the message exchange has been completed,
false otherwise.public void setTimeout(int timeout)
HttpAsyncExchangesetTimeout in interface HttpAsyncExchangepublic int getTimeout()
HttpAsyncExchangegetTimeout in interface HttpAsyncExchange