Package org.apache.hc.core5.http.nio
Interface AsyncServerRequestHandler<T>
-
- Type Parameters:
T- request representation.
@Contract(threading=STATELESS) public interface AsyncServerRequestHandler<T>
AsyncServerRequestHandler represents a routine for processing of a specific group of HTTP requests. Request execution filters 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:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceAsyncServerRequestHandler.ResponseTriggerResponse trigger that can be used to submit a final HTTP response and terminate HTTP request processing.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidhandle(T requestObject, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context)Triggered to handles the request object produced by theAsyncRequestConsumerreturned from theprepare(HttpRequest, EntityDetails, HttpContext)method.AsyncRequestConsumer<T>prepare(HttpRequest request, EntityDetails entityDetails, HttpContext context)Triggered to signal new incoming request.
-
-
-
Method Detail
-
prepare
AsyncRequestConsumer<T> prepare(HttpRequest request, EntityDetails entityDetails, HttpContext context) throws HttpException
Triggered to signal new incoming request. The handler can create aAsyncRequestConsumerbased on properties of the request head and entity details and let it process the request data stream. The request handler will be used to generate an object that represents request data.- Parameters:
request- the incoming request head.entityDetails- the request entity details ornullif the request does not enclose an entity.context- the actual execution context.- Returns:
- the request handler.
- Throws:
HttpException
-
handle
void handle(T requestObject, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context) throws HttpException, java.io.IOException
Triggered to handles the request object produced by theAsyncRequestConsumerreturned from theprepare(HttpRequest, EntityDetails, HttpContext)method. The handler can choose to send response messages immediately inside the call or asynchronously at some later point.- Parameters:
requestObject- the request object.responseTrigger- the response trigger.context- the actual execution context.- Throws:
HttpExceptionjava.io.IOException
-
-