Class DefaultH2RequestConverter
java.lang.Object
org.apache.hc.core5.http2.impl.DefaultH2RequestConverter
- All Implemented Interfaces:
H2MessageConverter<HttpRequest>
public final class DefaultH2RequestConverter
extends Object
implements H2MessageConverter<HttpRequest>
HTTP/2 request converter.
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts given list of HTTP/2 headers to aHttpMessage.convert(HttpRequest message) Converts givenHttpMessageto a list of HTTP/2 headers.private voidvalidatePathPseudoHeader(String method, String scheme, String path) Validates the:pathpseudo-header field based on the provided HTTP method and scheme.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DefaultH2RequestConverter
public DefaultH2RequestConverter()
-
-
Method Details
-
convert
Description copied from interface:H2MessageConverterConverts given list of HTTP/2 headers to aHttpMessage.- Specified by:
convertin interfaceH2MessageConverter<HttpRequest>- Parameters:
headers- list of HTTP/2 headers- Returns:
- HTTP message
- Throws:
HttpException- in case of HTTP protocol violation
-
convert
Description copied from interface:H2MessageConverterConverts givenHttpMessageto a list of HTTP/2 headers.- Specified by:
convertin interfaceH2MessageConverter<HttpRequest>- Parameters:
message- HTTP message- Returns:
- list of HTTP/2 headers
- Throws:
HttpException- in case of HTTP protocol violation
-
validatePathPseudoHeader
private void validatePathPseudoHeader(String method, String scheme, String path) throws ProtocolException Validates the:pathpseudo-header field based on the provided HTTP method and scheme.This method performs the following validations:
- Non-Empty Path: For 'http' or 'https' URIs, the
:pathpseudo-header field must not be empty. - OPTIONS Method: If the HTTP method is OPTIONS and the URI does not contain a path component,
the
:pathpseudo-header field must have a value of '*'. - Path Starting with '/': For 'http' or 'https' URIs, the
:pathpseudo-header field must either start with '/' or be '*'.
- Parameters:
method- The HTTP method of the request, e.g., GET, POST, OPTIONS, etc.scheme- The scheme of the request, e.g., http or https.path- The value of the:pathpseudo-header field.- Throws:
ProtocolException- if any of the validations fail.
- Non-Empty Path: For 'http' or 'https' URIs, the
-