Class RequestTE

  • All Implemented Interfaces:
    HttpRequestInterceptor

    @Contract(threading=IMMUTABLE)
    public class RequestTE
    extends java.lang.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
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestTE()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void process​(HttpRequest request, EntityDetails entity, HttpContext context)
      Processes the TE header of the given HTTP request and ensures compliance with HTTP/1.1 requirements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCE

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

      • RequestTE

        public RequestTE()
        Default constructor.
    • Method Detail

      • process

        public void process​(HttpRequest request,
                            EntityDetails entity,
                            HttpContext context)
                     throws HttpException,
                            java.io.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
        java.io.IOException - in case of an I/O error