Package io.micronaut.http.client
Class HttpVersionSelection
java.lang.Object
io.micronaut.http.client.HttpVersionSelection
This class collects information about HTTP client protocol version settings, such as the
HttpVersionSelection.PlaintextMode
and the ALPN configuration.- Since:
- 4.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The connection mode to use for plaintext (non-TLS) connections. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static @Nullable HttpVersionSelection
forClientAnnotation
(AnnotationMetadata metadata) Infer the version selection for the givenClient
annotation, if any version settings are set.static HttpVersionSelection
forClientConfiguration
(HttpClientConfiguration clientConfiguration) Construct a version selection from the given client configuration.static @NonNull HttpVersionSelection
forLegacyVersion
(@NonNull HttpVersion httpVersion) Get theHttpVersionSelection
that matches Micronaut HTTP client 3.x behavior for the given version setting.String[]
int
hashCode()
boolean
isAlpn()
boolean
boolean
isHttp3()
-
Field Details
-
ALPN_HTTP_1
ALPN protocol ID for HTTP/1.1.- See Also:
-
ALPN_HTTP_2
ALPN protocol ID for HTTP/2.- See Also:
-
ALPN_HTTP_3
ALPN protocol ID for HTTP/3. When this is selected, it must be the only ALPN ID, since we will connect via UDP.- See Also:
-
-
Method Details
-
forLegacyVersion
@NonNull public static @NonNull HttpVersionSelection forLegacyVersion(@NonNull @NonNull HttpVersion httpVersion) Get theHttpVersionSelection
that matches Micronaut HTTP client 3.x behavior for the given version setting.- Parameters:
httpVersion
- The HTTP version as configured for Micronaut HTTP client 3.x- Returns:
- The version selection
-
forClientConfiguration
public static HttpVersionSelection forClientConfiguration(HttpClientConfiguration clientConfiguration) Construct a version selection from the given client configuration.- Parameters:
clientConfiguration
- The client configuration- Returns:
- The configured version selection
-
forClientAnnotation
@Internal @Nullable public static @Nullable HttpVersionSelection forClientAnnotation(AnnotationMetadata metadata) Infer the version selection for the givenClient
annotation, if any version settings are set.- Parameters:
metadata
- The annotation metadata possibly containing aClient
annotation- Returns:
- The configured version selection, or
null
if the version is not explicitly set and should be inherited from the normal configuration instead.
-
getPlaintextMode
- Returns:
- Connection mode to use for plaintext connections
-
getAlpnSupportedProtocols
- Returns:
- Protocols that should be shown as supported via ALPN
-
isAlpn
- Returns:
- Whether ALPN should be used
-
isHttp2CipherSuites
- Returns:
- Whether TLS cipher suites should be constrained to those defined by the HTTP/2 spec
-
isHttp3
-
equals
-
hashCode
public int hashCode()
-