- All Superinterfaces:
ReleasableResource
- All Known Implementing Classes:
Http2ClientImpl
Integration for HTTP versions to provide a single API.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
How does the provider support the request. -
Method Summary
Modifier and TypeMethodDescriptionclientRequest
(FullClientRequest<?> clientRequest, ClientUri clientUri) Create a client request based on the provided HTTP request that is for the version of this client.default boolean
isTcp()
For TCP based protocols, we can do ALPN negotiation, obtain a connection, and then let the client handle the protocol.supports
(FullClientRequest<?> clientRequest, ClientUri clientUri) Return whether this HTTP version can handle the provided request.Methods inherited from interface io.helidon.webclient.api.ReleasableResource
closeResource, releaseResource
-
Method Details
-
supports
Return whether this HTTP version can handle the provided request.Examples:
- HTTP/1.1 always returns true, as it is the fallback protocol of all other protocols
- HTTP/2 returns true when upgrade is enabled, false when prior-knowledge is specified (as we can always attempt to upgrade and fallback to 1.1 in the first case, but we would fail with prior-knowledge, unless the endpoint is known to be HTTP/2
- HTTP/3 would always return true, as it cannot fallback once a connection is attempted
- An explicit protocol id is configured for the request -
HttpClientRequest.protocolId(String)
- There is no fallback protocol enabled, in such a case, we use the one with highest priority - see
WebClientConfig.BuilderBase.addProtocolPreference(String)
- We get an
Alt-Svc
header from a response that points us to a protocol version (we only support permanent protocol changes,Alt-Svc
with timeout will be ignored - This protocol version already handled a request to such an endpoint and has the connection available
- Parameters:
clientRequest
- HTTP requestclientUri
- URI to invoke- Returns:
true
if we are sure we can handle this request with this protocol version
-
clientRequest
Create a client request based on the provided HTTP request that is for the version of this client.- Parameters:
clientRequest
- request configurationclientUri
- URI to invoke (resolved)- Returns:
- a new request
-
isTcp
default boolean isTcp()For TCP based protocols, we can do ALPN negotiation, obtain a connection, and then let the client handle the protocol. Similar for proxies - we can establish a proxy connection, and then let the client handle the protocol. For UDP based protocols, we need to wait forAlt-Svc
headers before attempting anything, or have an explicit version configured.- Returns:
- whether this is a TCP based HTTP protocol, defaults to
true
-