Class HttpVersionSelection

java.lang.Object
io.micronaut.http.client.HttpVersionSelection

public final class HttpVersionSelection extends Object
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
  • Field Details

    • ALPN_HTTP_1

      public static final String ALPN_HTTP_1
      ALPN protocol ID for HTTP/1.1.
      See Also:
    • ALPN_HTTP_2

      public static final String ALPN_HTTP_2
      ALPN protocol ID for HTTP/2.
      See Also:
    • ALPN_HTTP_3

      public static final String 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 the HttpVersionSelection 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 given Client annotation, if any version settings are set.
      Parameters:
      metadata - The annotation metadata possibly containing a Client 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

      @Internal public HttpVersionSelection.PlaintextMode getPlaintextMode()
      Returns:
      Connection mode to use for plaintext connections
    • getAlpnSupportedProtocols

      @Internal public String[] 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object