Class RequestTE

java.lang.Object
org.apache.hc.core5.http.protocol.RequestTE
All Implemented Interfaces:
HttpRequestInterceptor

@Contract(threading=IMMUTABLE) public class RequestTE extends Object implements HttpRequestInterceptor
HTTP protocol interceptor responsible for validating and processing the HttpHeaders.TE header field in HTTP/1.1 requests.

The HttpHeaders.TE header is used to indicate transfer codings the client is willing to accept and, in some cases, whether the client is willing to accept trailer fields. This interceptor ensures that the HttpHeaders.TE header does not include the chunked transfer coding and validates the presence of the Connection: TE header.

For HTTP/1.1 requests, the HttpHeaders.TE header can contain multiple values separated by commas and may include quality values (denoted by q=) separated by semicolons.

In case of HTTP/2, this validation is skipped, and another layer of logic handles the specifics of HTTP/2 compliance.

Since:
5.4
  • Field Details

    • INSTANCE

      public static final HttpRequestInterceptor INSTANCE
      Singleton instance of the RequestTE interceptor.
  • Constructor Details

    • RequestTE

      public RequestTE()
      Default constructor.
  • Method Details

    • process

      public void process(HttpRequest request, EntityDetails entity, HttpContext context) throws HttpException, IOException
      Processes the TE header of the given HTTP request and ensures compliance with HTTP/1.1 requirements.

      If the TE header is present, this method validates that:

      • The TE header does not include the chunked transfer coding, which is implicitly supported for HTTP/1.1.
      • The Connection header includes the TE directive, as required by the protocol.
      Specified by:
      process in interface HttpRequestInterceptor
      Parameters:
      request - the HTTP request containing the headers to validate
      entity - the entity associated with the request (may be null)
      context - the execution context for the request
      Throws:
      HttpException - if the TE header contains invalid values or the Connection header is missing
      IOException - in case of an I/O error