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 AtomicBooleanprivate final NHttpServerConnectionprivate final HttpContextprivate final HttpRequestprivate final HttpResponseprivate 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.intReturns timeout for this message exchange.booleanDetermines whether or not the message exchange has been completed.voidsetCallback(Cancellable cancellable) SetsCancellablecallback to be invoked in case the underlying connection times out or gets terminated prematurely by the client.voidsetTimeout(int timeout) Sets timeout for this message exchange.voidSubmits the default HTTP response and completed the message exchange.voidsubmitResponse(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:HttpAsyncExchangeReturns the received HTTP request message.- Specified by:
getRequestin interfaceHttpAsyncExchange- Returns:
- received HTTP request message.
-
getResponse
Description copied from interface:HttpAsyncExchangeReturns the default HTTP response message. Once ready the response message can submitted usingHttpAsyncExchange.submitResponse()method.- Specified by:
getResponsein interfaceHttpAsyncExchange- Returns:
- default HTTP response message.
-
setCallback
Description copied from interface:HttpAsyncExchangeSetsCancellablecallback 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:
setCallbackin interfaceHttpAsyncExchange
-
submitResponse
Description copied from interface:HttpAsyncExchangeSubmits an HTTP response using a customHttpAsyncResponseProducer.- Specified by:
submitResponsein interfaceHttpAsyncExchange
-
submitResponse
public void submitResponse()Description copied from interface:HttpAsyncExchangeSubmits the default HTTP response and completed the message exchange. If the response encloses anHttpEntityinstance the entity is also expected to implement theHttpAsyncContentProducerinterface for efficient content streaming to a non-blocking HTTP connection.- Specified by:
submitResponsein interfaceHttpAsyncExchange
-
isCompleted
public boolean isCompleted()Description copied from interface:HttpAsyncExchangeDetermines whether or not the message exchange has been completed.- Specified by:
isCompletedin interfaceHttpAsyncExchange- Returns:
trueif the message exchange has been completed,falseotherwise.
-
setTimeout
public void setTimeout(int timeout) Description copied from interface:HttpAsyncExchangeSets timeout for this message exchange.- Specified by:
setTimeoutin interfaceHttpAsyncExchange
-
getTimeout
public int getTimeout()Description copied from interface:HttpAsyncExchangeReturns timeout for this message exchange.- Specified by:
getTimeoutin interfaceHttpAsyncExchange
-