class HttpAsyncService.HttpAsyncExchangeImpl extends Object implements HttpAsyncExchange
Modifier and Type | Field and Description |
---|---|
private 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 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()
HttpAsyncExchange
getRequest
in interface HttpAsyncExchange
public HttpResponse getResponse()
HttpAsyncExchange
HttpAsyncExchange.submitResponse()
method.getResponse
in interface HttpAsyncExchange
public void setCallback(Cancellable cancellable)
HttpAsyncExchange
Cancellable
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 HttpAsyncExchange
public void submitResponse(HttpAsyncResponseProducer responseProducer)
HttpAsyncExchange
HttpAsyncResponseProducer
.submitResponse
in interface HttpAsyncExchange
public void submitResponse()
HttpAsyncExchange
HttpEntity
instance
the entity is also expected to implement the
HttpAsyncContentProducer
interface for efficient content streaming to a non-blocking HTTP
connection.submitResponse
in interface HttpAsyncExchange
public boolean isCompleted()
HttpAsyncExchange
isCompleted
in interface HttpAsyncExchange
true
if the message exchange has been completed,
false
otherwise.public void setTimeout(int timeout)
HttpAsyncExchange
setTimeout
in interface HttpAsyncExchange
public int getTimeout()
HttpAsyncExchange
getTimeout
in interface HttpAsyncExchange
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses