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 Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpRequestInterceptorSingleton instance of theRequestTEinterceptor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprocess(HttpRequest request, EntityDetails entity, HttpContext context) Processes theTEheader of the given HTTP request and ensures compliance with HTTP/1.1 requirements.
-
Field Details
-
INSTANCE
Singleton instance of theRequestTEinterceptor.
-
-
Constructor Details
-
RequestTE
public RequestTE()Default constructor.
-
-
Method Details
-
process
public void process(HttpRequest request, EntityDetails entity, HttpContext context) throws HttpException, 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 missingIOException- in case of an I/O error
- The
-