Class Http3Settings

java.lang.Object
io.netty.handler.codec.http3.Http3Settings
All Implemented Interfaces:
Iterable<Map.Entry<Long,Long>>

public final class Http3Settings extends Object implements Iterable<Map.Entry<Long,Long>>
Represents a collection of HTTP/3 settings as defined by the HTTP/3 specification.

This class provides type-safe accessors for standard HTTP/3 settings such as:

  • QPACK_MAX_TABLE_CAPACITY (0x1)
  • MAX_FIELD_SECTION_SIZE (0x6)
  • QPACK_BLOCKED_STREAMS (0x7)
  • ENABLE_CONNECT_PROTOCOL (0x8)
  • H3_DATAGRAM (0x33)invalid input: '<'/>
Non-standard settings are ignored Reserved HTTP/2 setting identifiers are rejected.
  • Constructor Details

    • Http3Settings

      public Http3Settings()
      Creates a new instance
  • Method Details

    • put

      @Nullable public Long put(long key, Long value)
      Stores a setting value for the specified identifier.

      The key and value are validated according to the HTTP/3 specification. Reserved HTTP/2 setting identifiers and negative values are not allowed. Ignore any unknown id/key as per invalid input: '<'a href="https://www.rfc-editor.org/rfc/rfc9114.html#section-7.2.4-9>rfc9114

      Parameters:
      key - the numeric setting identifier
      value - the setting value (non-null)
      Returns:
      the previous value associated with the key, or null if none
      Throws:
      IllegalArgumentException - if the key or value is invalid
    • get

      @Nullable public Long get(long key)
      Returns the value of the specified setting identifier.
      Parameters:
      key - the numeric setting identifier
      Returns:
      the setting value, or null if not set
    • qpackMaxTableCapacity

      @Nullable public Long qpackMaxTableCapacity()
      Returns the QPACK_MAX_TABLE_CAPACITY value.
      Returns:
      the current QPACK maximum table capacity, or null if not set
    • qpackMaxTableCapacity

      public Http3Settings qpackMaxTableCapacity(long value)
      Sets the QPACK_MAX_TABLE_CAPACITY value.
      Parameters:
      value - QPACK maximum table capacity (must be ≥ 0)
      Returns:
      this instance for method chaining
    • maxFieldSectionSize

      @Nullable public Long maxFieldSectionSize()
      Returns the MAX_FIELD_SECTION_SIZE value.
      Returns:
      the maximum field section size, or null if not set
    • maxFieldSectionSize

      public Http3Settings maxFieldSectionSize(long value)
      Sets the MAX_FIELD_SECTION_SIZE value.
      Parameters:
      value - maximum field section size (must be ≥ 0)
      Returns:
      this instance for method chaining
    • qpackBlockedStreams

      @Nullable public Long qpackBlockedStreams()
      Returns the QPACK_BLOCKED_STREAMS value.
      Returns:
      the number of blocked streams, or null if not set
    • qpackBlockedStreams

      public Http3Settings qpackBlockedStreams(long value)
      Sets the QPACK_BLOCKED_STREAMS value.
      Parameters:
      value - number of blocked streams (must be ≥ 0)
      Returns:
      this instance for method chaining
    • connectProtocolEnabled

      @Nullable public Boolean connectProtocolEnabled()
      Returns whether the ENABLE_CONNECT_PROTOCOL setting is enabled.
      Returns:
      true if enabled, false if disabled, or null if not set
    • enableConnectProtocol

      public Http3Settings enableConnectProtocol(boolean enabled)
      Sets the ENABLE_CONNECT_PROTOCOL flag.
      Parameters:
      enabled - whether to enable the CONNECT protocol
      Returns:
      this instance for method chaining
    • h3DatagramEnabled

      @Nullable public Boolean h3DatagramEnabled()
      Returns whether the H3_DATAGRAM setting is enabled.
      Returns:
      true if enabled, false if disabled, or null if not set
    • enableH3Datagram

      public Http3Settings enableH3Datagram(boolean enabled)
      Sets the H3_DATAGRAM settings identifier.
      Parameters:
      enabled - whether to enable the H3 Datagram
      Returns:
      this instance for method chaining
    • putAll

      public Http3Settings putAll(Http3Settings http3Settings)
      Replaces all current settings with those from another Http3Settings instance.
      Parameters:
      http3Settings - the source settings (non-null)
      Returns:
      this instance for method chaining
    • defaultSettings

      public static Http3Settings defaultSettings()
      Returns a new Http3Settings instance with default values:
      • QPACK_MAX_TABLE_CAPACITY = 0
      • QPACK_BLOCKED_STREAMS = 0
      • ENABLE_CONNECT_PROTOCOL = false
      • MAX_FIELD_SECTION_SIZE = unlimited
      • H3_DATAGRAM = false invalid input: '<'/>
      Returns:
      a default Http3Settings instance
    • iterator

      public Iterator<Map.Entry<Long,Long>> iterator()
      Returns an iterator over the settings entries in this object. Each entry’s key is the numeric setting identifier, and the value is its numeric value.
      Specified by:
      iterator in interface Iterable<Map.Entry<Long,Long>>
      Returns:
      an iterator over immutable Map.Entry objects
    • equals

      public boolean equals(Object o)
      Compares this settings object to another for equality. Two instances are equal if they contain the same key–value pairs.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      true if equal, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code of this settings object, based on its key–value pairs.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • toString

      public String toString()
      Returns a string representation of this settings object in the form:
      Http3Settings{0x1=100, 0x6=16384, 0x7=0}
      
      Overrides:
      toString in class Object
      Returns:
      a human-readable string representation of the settings