org.apache.hc.core5.http.nio.support

## Class BasicServerExchangeHandler<T>

- java.lang.Object
- - org.apache.hc.core5.http.nio.support.AbstractServerExchangeHandler<T>
  - - org.apache.hc.core5.http.nio.support.BasicServerExchangeHandler<T>

- All Implemented Interfaces:
    AsyncDataConsumer, AsyncDataExchangeHandler, AsyncDataProducer, AsyncServerExchangeHandler, ResourceHolder

      public class BasicServerExchangeHandler<T>
      extends AbstractServerExchangeHandler<T>

  Basic `AbstractServerExchangeHandler` implementation that delegates request processing and response generation to a `AsyncServerRequestHandler`.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicServerExchangeHandler(AsyncServerRequestHandler<T> requestHandler)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `handle(T requestMessage, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context)` Triggered to handles the request object produced by the `AsyncRequestConsumer` returned from the `AbstractServerExchangeHandler.supplyConsumer(HttpRequest, EntityDetails, HttpContext)` method.
    `protected AsyncRequestConsumer<T>` | `supplyConsumer(HttpRequest request, EntityDetails entityDetails, HttpContext context)` Triggered to supply a request consumer to process the incoming request.

    - ### Methods inherited from class org.apache.hc.core5.http.nio.support.AbstractServerExchangeHandler

      `available, consume, failed, handleRequest, produce, releaseResources, streamEnd, updateCapacity`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicServerExchangeHandler

          public BasicServerExchangeHandler(AsyncServerRequestHandler<T> requestHandler)

  - ### Method Detail

    - #### supplyConsumer

          protected AsyncRequestConsumer<T> supplyConsumer(HttpRequest request,
                                               EntityDetails entityDetails,
                                               HttpContext context)
                                                    throws HttpException

      Description copied from class: `AbstractServerExchangeHandler`
      Triggered to supply a request consumer to process the incoming request.
      Specified by:
        `supplyConsumer` in class `AbstractServerExchangeHandler<T>`
      Parameters:
        `request` - the request message.
        `entityDetails` - the request entity details.
        `context` - the actual execution context.
      Returns:
        the request consumer.
      Throws:
        `HttpException`

    - #### handle

          protected void handle(T requestMessage,
                    AsyncServerRequestHandler.ResponseTrigger responseTrigger,
                    HttpContext context)
                         throws HttpException,
                                IOException

      Description copied from class: `AbstractServerExchangeHandler`
      Triggered to handles the request object produced by the `AsyncRequestConsumer` returned from the `AbstractServerExchangeHandler.supplyConsumer(HttpRequest, EntityDetails, HttpContext)` method. The handler can choose to send response messages immediately inside the call or asynchronously at some later point.
      Specified by:
        `handle` in class `AbstractServerExchangeHandler<T>`
      Parameters:
        `requestMessage` - the request message.
        `responseTrigger` - the response trigger.
        `context` - the actual execution context.
      Throws:
        `HttpException`
        `IOException`

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