org.apache.http.nio.protocol
Interface NHttpRequestHandler

All Known Implementing Classes:
SimpleNHttpRequestHandler

Deprecated. (4.2) use HttpAsyncRequestHandler

@Deprecated
public interface NHttpRequestHandler

NHttpRequestHandler represents a routine for asynchronous processing of a specific group of non-blocking HTTP requests. Protocol handlers are designed to take care of protocol specific aspects, whereas individual request handlers are expected to take care of application specific HTTP processing. The main purpose of a request handler is to generate a response object with a content entity to be sent back to the client in response to the given request

Since:
4.0

Method Summary
 ConsumingNHttpEntity entityRequest(HttpEntityEnclosingRequest request, HttpContext context)
          Deprecated. Triggered when a request is received with an entity.
 void handle(HttpRequest request, HttpResponse response, NHttpResponseTrigger trigger, HttpContext context)
          Deprecated. Initiates processing of the request.
 

Method Detail

entityRequest

ConsumingNHttpEntity entityRequest(HttpEntityEnclosingRequest request,
                                   HttpContext context)
                                   throws HttpException,
                                          IOException
Deprecated. 
Triggered when a request is received with an entity. This method should return a ConsumingNHttpEntity that will be used to consume the entity. null is a valid response value, and will indicate that the entity should be silently ignored.

After the entity is fully consumed, handle(HttpRequest, HttpResponse, NHttpResponseTrigger, HttpContext) is called to notify a full request & entity are ready to be processed.

Parameters:
request - the entity enclosing request.
context - the execution context.
Returns:
non-blocking HTTP entity.
Throws:
IOException - in case of an I/O error.
HttpException - in case of HTTP protocol violation or a processing problem.

handle

void handle(HttpRequest request,
            HttpResponse response,
            NHttpResponseTrigger trigger,
            HttpContext context)
            throws HttpException,
                   IOException
Deprecated. 
Initiates processing of the request. This method does not have to submit a response immediately. It can defer transmission of the HTTP response back to the client without blocking the I/O thread by delegating the process of handling the HTTP request to a worker thread. The worker thread in its turn can use the instance of NHttpResponseTrigger passed as a parameter to submit a response as at a later point of time once content of the response becomes available.

Parameters:
request - the HTTP request.
response - the HTTP response.
trigger - the response trigger.
context - the HTTP execution context.
Throws:
IOException - in case of an I/O error.
HttpException - in case of HTTP protocol violation or a processing problem.


Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.