Package org.apache.http.nio.protocol
Class HttpAsyncService.HttpAsyncExchangeImpl
java.lang.Object
org.apache.http.nio.protocol.HttpAsyncService.HttpAsyncExchangeImpl
- All Implemented Interfaces:
HttpAsyncExchange
- Enclosing class:
HttpAsyncService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBoolean
private final NHttpServerConnection
private final HttpContext
private final HttpRequest
private final HttpResponse
private final HttpAsyncService.State
-
Constructor Summary
ConstructorsConstructorDescriptionHttpAsyncExchangeImpl
(HttpRequest request, HttpResponse response, HttpAsyncService.State state, NHttpServerConnection conn, HttpContext context) -
Method Summary
Modifier and TypeMethodDescriptionReturns the received HTTP request message.Returns the default HTTP response message.int
Returns timeout for this message exchange.boolean
Determines whether or not the message exchange has been completed.void
setCallback
(Cancellable cancellable) SetsCancellable
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
Submits the default HTTP response and completed the message exchange.void
submitResponse
(HttpAsyncResponseProducer responseProducer) Submits an HTTP response using a customHttpAsyncResponseProducer
.
-
Field Details
-
completed
-
request
-
response
-
state
-
conn
-
context
-
-
Constructor Details
-
HttpAsyncExchangeImpl
public HttpAsyncExchangeImpl(HttpRequest request, HttpResponse response, HttpAsyncService.State state, NHttpServerConnection conn, HttpContext context)
-
-
Method Details
-
getRequest
Description copied from interface:HttpAsyncExchange
Returns the received HTTP request message.- Specified by:
getRequest
in interfaceHttpAsyncExchange
- Returns:
- received HTTP request message.
-
getResponse
Description copied from interface:HttpAsyncExchange
Returns the default HTTP response message. Once ready the response message can submitted usingHttpAsyncExchange.submitResponse()
method.- Specified by:
getResponse
in interfaceHttpAsyncExchange
- Returns:
- default HTTP response message.
-
setCallback
Description copied from interface:HttpAsyncExchange
SetsCancellable
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.- Specified by:
setCallback
in interfaceHttpAsyncExchange
-
submitResponse
Description copied from interface:HttpAsyncExchange
Submits an HTTP response using a customHttpAsyncResponseProducer
.- Specified by:
submitResponse
in interfaceHttpAsyncExchange
-
submitResponse
public void submitResponse()Description copied from interface:HttpAsyncExchange
Submits the default HTTP response and completed the message exchange. If the response encloses anHttpEntity
instance the entity is also expected to implement theHttpAsyncContentProducer
interface for efficient content streaming to a non-blocking HTTP connection.- Specified by:
submitResponse
in interfaceHttpAsyncExchange
-
isCompleted
public boolean isCompleted()Description copied from interface:HttpAsyncExchange
Determines whether or not the message exchange has been completed.- Specified by:
isCompleted
in interfaceHttpAsyncExchange
- Returns:
true
if the message exchange has been completed,false
otherwise.
-
setTimeout
public void setTimeout(int timeout) Description copied from interface:HttpAsyncExchange
Sets timeout for this message exchange.- Specified by:
setTimeout
in interfaceHttpAsyncExchange
-
getTimeout
public int getTimeout()Description copied from interface:HttpAsyncExchange
Returns timeout for this message exchange.- Specified by:
getTimeout
in interfaceHttpAsyncExchange
-