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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe connection mode to use for plaintext (non-TLS) connections. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic @Nullable HttpVersionSelectionforClientAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata) Infer the version selection for the givenClientannotation, if any version settings are set.static HttpVersionSelectionforClientConfiguration(HttpClientConfiguration clientConfiguration) Construct a version selection from the given client configuration.static @NonNull HttpVersionSelectionforLegacyVersion(@NonNull io.micronaut.http.HttpVersion httpVersion) Get theHttpVersionSelectionthat matches Micronaut HTTP client 3.x behavior for the given version setting.String[]inthashCode()booleanisAlpn()booleanbooleanisHttp3()
-
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 io.micronaut.http.HttpVersion httpVersion) Get theHttpVersionSelectionthat 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(io.micronaut.core.annotation.AnnotationMetadata metadata) Infer the version selection for the givenClientannotation, if any version settings are set.- Parameters:
metadata- The annotation metadata possibly containing aClientannotation- Returns:
- The configured version selection, or
nullif 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
@Internal public boolean isAlpn()- Returns:
- Whether ALPN should be used
-
isHttp2CipherSuites
@Internal public boolean isHttp2CipherSuites()- Returns:
- Whether TLS cipher suites should be constrained to those defined by the HTTP/2 spec
-
isHttp3
@Internal public boolean isHttp3() -
equals
-
hashCode
public int hashCode()
-