Package org.apache.hc.core5.http.nio
Interface AsyncServerRequestHandler<T>
- Type Parameters:
T
- request representation.
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 ClassesModifier and TypeInterfaceDescriptionstatic interface
Response trigger that can be used to submit a final HTTP response and terminate HTTP request processing. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(T requestObject, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context) Triggered to handles the request object produced by theAsyncRequestConsumer
returned from theprepare(HttpRequest, EntityDetails, HttpContext)
method.prepare
(HttpRequest request, EntityDetails entityDetails, HttpContext context) Triggered to signal new incoming request.
-
Method Details
-
prepare
AsyncRequestConsumer<T> prepare(HttpRequest request, EntityDetails entityDetails, HttpContext context) throws HttpException Triggered to signal new incoming request. The handler can create aAsyncRequestConsumer
based 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 ornull
if 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, IOException Triggered to handles the request object produced by theAsyncRequestConsumer
returned 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:
HttpException
IOException
-