Class HttpServerExpectationFilter

java.lang.Object
org.apache.hc.core5.http.io.support.HttpServerExpectationFilter
All Implemented Interfaces:
HttpFilterHandler

@Contract(threading=STATELESS) public class HttpServerExpectationFilter extends Object implements HttpFilterHandler
HttpServerExpectationFilter add support for the Expect-Continue handshake to the request processing pipeline.
Since:
5.0
  • Constructor Details

    • HttpServerExpectationFilter

      public HttpServerExpectationFilter()
  • Method Details

    • verify

      protected boolean verify(ClassicHttpRequest request, HttpContext context) throws HttpException
      Verifies the HTTP request and decides whether it meets server expectations and the request processing can continue.
      Parameters:
      request - the incoming HTTP request.
      context - the actual execution context.
      Returns:
      true if the request meets expectations or false otherwise.
      Throws:
      HttpException - in case of an HTTP protocol violation.
    • generateResponseContent

      protected HttpEntity generateResponseContent(HttpResponse expectationFailed) throws HttpException
      Generates response content entity for the final HTTP response with an error status representing the cause of expectation failure.
      Parameters:
      expectationFailed - the final HTTP response.
      Returns:
      the content entity for the final HTTP response with an error status representing the cause of expectation failure.
      Throws:
      HttpException - in case of an HTTP protocol violation.
    • handle

      public final void handle(ClassicHttpRequest request, HttpFilterChain.ResponseTrigger responseTrigger, HttpContext context, HttpFilterChain chain) throws HttpException, IOException
      Description copied from interface: HttpFilterHandler
      Processes the incoming HTTP request and if processing has been completed submits a final response to the client. The handler must not use the response trigger after passing control to the next filter with the HttpFilterChain.proceed(ClassicHttpRequest, HttpFilterChain.ResponseTrigger, HttpContext) method.
      Specified by:
      handle in interface HttpFilterHandler
      Parameters:
      request - the actual request.
      responseTrigger - the response trigger.
      context - the actual execution context.
      chain - the next element in the request processing chain.
      Throws:
      HttpException - in case of an HTTP protocol violation.
      IOException - in case of an I/O error.