Class AsyncNHttpServiceHandler

java.lang.Object
org.apache.http.nio.protocol.NHttpHandlerBase
org.apache.http.nio.protocol.AsyncNHttpServiceHandler
All Implemented Interfaces:
NHttpServiceHandler

@Deprecated @Contract(threading=IMMUTABLE_CONDITIONAL) public class AsyncNHttpServiceHandler extends NHttpHandlerBase implements NHttpServiceHandler
Deprecated.
Fully asynchronous HTTP server side protocol handler implementation that implements the essential requirements of the HTTP protocol for the server side message processing as described by RFC 2616. It is capable of processing HTTP requests with nearly constant memory footprint. Only HTTP message heads are stored in memory, while content of message bodies is streamed directly from the entity to the underlying channel (and vice versa) ConsumingNHttpEntity and ProducingNHttpEntity interfaces.

When using this class, it is important to ensure that entities supplied for writing implement ProducingNHttpEntity. Doing so will allow the entity to be written out asynchronously. If entities supplied for writing do not implement ProducingNHttpEntity, a delegate is added that buffers the entire contents in memory. Additionally, the buffering might take place in the I/O thread, which could cause I/O to block temporarily. For best results, ensure that all entities set on HttpResponses from NHttpRequestHandlers implement ProducingNHttpEntity.

If incoming requests enclose a content entity, NHttpRequestHandlers are expected to return a ConsumingNHttpEntity for reading the content. After the entity is finished reading the data, NHttpRequestHandler.handle(HttpRequest, HttpResponse, NHttpResponseTrigger, HttpContext) is called to generate a response.

Individual NHttpRequestHandlers do not have to submit a response immediately. They can defer transmission of the HTTP response back to the client without blocking the I/O thread and to delegate the processing the HTTP request to a worker thread. The worker thread in its turn can use an instance of NHttpResponseTrigger passed as a parameter to submit a response as at a later point of time once the response becomes available.

Since:
4.0