Class RequestTE
- java.lang.Object
-
- org.apache.hc.core5.http.protocol.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 theHttpHeaders.TEheader field in HTTP/1.1 requests.The
HttpHeaders.TEheader 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 theHttpHeaders.TEheader does not include thechunkedtransfer coding and validates the presence of theConnection: TEheader.For HTTP/1.1 requests, the
HttpHeaders.TEheader can contain multiple values separated by commas and may include quality values (denoted byq=) 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 Summary
Fields Modifier and Type Field Description static HttpRequestInterceptorINSTANCESingleton instance of theRequestTEinterceptor.
-
Constructor Summary
Constructors Constructor Description RequestTE()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprocess(HttpRequest request, EntityDetails entity, HttpContext context)Processes theTEheader of the given HTTP request and ensures compliance with HTTP/1.1 requirements.
-
-
-
Field Detail
-
INSTANCE
public static final HttpRequestInterceptor INSTANCE
Singleton instance of theRequestTEinterceptor.
-
-
Method Detail
-
process
public void process(HttpRequest request, EntityDetails entity, HttpContext context) throws HttpException, java.io.IOException
Processes theTEheader of the given HTTP request and ensures compliance with HTTP/1.1 requirements.If the
TEheader is present, this method validates that:- The
TEheader does not include thechunkedtransfer coding, which is implicitly supported for HTTP/1.1. - The
Connectionheader includes theTEdirective, as required by the protocol.
- Specified by:
processin interfaceHttpRequestInterceptor- Parameters:
request- the HTTP request containing the headers to validateentity- the entity associated with the request (may benull)context- the execution context for the request- Throws:
HttpException- if theTEheader contains invalid values or theConnectionheader is missingjava.io.IOException- in case of an I/O error
- The
-
-