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 and Description
    --- | ---
    `static interface` | `AsyncServerRequestHandler.ResponseTrigger` Response trigger that can be used to submit a final HTTP response and terminate HTTP request processing.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `handle(T requestObject, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context)` Triggered to handles the request object produced by the `AsyncRequestConsumer` returned from the `prepare(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 a `AsyncRequestConsumer` 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 or `null` 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 the `AsyncRequestConsumer` returned from the `prepare(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`

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