Package io.netty.handler.codec.http3
Class Http3Settings
- java.lang.Object
-
- io.netty.handler.codec.http3.Http3Settings
-
- All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<java.lang.Long,java.lang.Long>>
public final class Http3Settings extends java.lang.Object implements java.lang.Iterable<java.util.Map.Entry<java.lang.Long,java.lang.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)>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHttp3Settings.NonStandardHttp3SettingsValidatorAllows to handle non-standard settings.
-
Constructor Summary
Constructors Constructor Description Http3Settings()Creates a new instanceHttp3Settings(Http3Settings.NonStandardHttp3SettingsValidator nonStandardSettingsValidator)Creates a new instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.BooleanconnectProtocolEnabled()Returns whether theENABLE_CONNECT_PROTOCOLsetting is enabled.static Http3SettingsdefaultSettings()Returns a newHttp3Settingsinstance with default values:QPACK_MAX_TABLE_CAPACITY= 0QPACK_BLOCKED_STREAMS= 0ENABLE_CONNECT_PROTOCOL= falseMAX_FIELD_SECTION_SIZE= unlimitedH3_DATAGRAM= false >Http3SettingsenableConnectProtocol(boolean enabled)Sets theENABLE_CONNECT_PROTOCOLflag.Http3SettingsenableH3Datagram(boolean enabled)Sets theH3_DATAGRAMsettings identifier.booleanequals(java.lang.Object o)Compares this settings object to another for equality.java.lang.Longget(long key)Returns the value of the specified setting identifier.java.lang.Booleanh3DatagramEnabled()Returns whether theH3_DATAGRAMsetting is enabled.inthashCode()Returns the hash code of this settings object, based on its key–value pairs.java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.Long>>iterator()Returns an iterator over the settings entries in this object.java.lang.LongmaxFieldSectionSize()Returns theMAX_FIELD_SECTION_SIZEvalue.Http3SettingsmaxFieldSectionSize(long value)Sets theMAX_FIELD_SECTION_SIZEvalue.java.lang.Longput(long key, java.lang.Long value)Stores a setting value for the specified identifier.Http3SettingsputAll(Http3Settings http3Settings)Replaces all current settings with those from anotherHttp3Settingsinstance.java.lang.LongqpackBlockedStreams()Returns theQPACK_BLOCKED_STREAMSvalue.Http3SettingsqpackBlockedStreams(long value)Sets theQPACK_BLOCKED_STREAMSvalue.java.lang.LongqpackMaxTableCapacity()Returns theQPACK_MAX_TABLE_CAPACITYvalue.Http3SettingsqpackMaxTableCapacity(long value)Sets theQPACK_MAX_TABLE_CAPACITYvalue.java.lang.StringtoString()Returns a string representation of this settings object in the form:
-
-
-
Constructor Detail
-
Http3Settings
public Http3Settings()
Creates a new instance
-
Http3Settings
public Http3Settings(Http3Settings.NonStandardHttp3SettingsValidator nonStandardSettingsValidator)
Creates a new instance- Parameters:
nonStandardSettingsValidator- theHttp3Settings.NonStandardHttp3SettingsValidatorto use to check if a specific setting that is non-standard should be supported or not.
-
-
Method Detail
-
put
@Nullable public java.lang.Long put(long key, java.lang.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 Parameters:
key- the numeric setting identifiervalue- the setting value (non-null)- Returns:
- the previous value associated with the key, or
nullif none- Throws:
java.lang.IllegalArgumentException- if the key or value is invalid-
get
@Nullable public java.lang.Long get(long key)
Returns the value of the specified setting identifier.- Parameters:
key- the numeric setting identifier- Returns:
- the setting value, or
nullif not set
-
qpackMaxTableCapacity
@Nullable public java.lang.Long qpackMaxTableCapacity()
Returns theQPACK_MAX_TABLE_CAPACITYvalue.- Returns:
- the current QPACK maximum table capacity, or
nullif not set
-
qpackMaxTableCapacity
public Http3Settings qpackMaxTableCapacity(long value)
Sets theQPACK_MAX_TABLE_CAPACITYvalue.- Parameters:
value- QPACK maximum table capacity (must be ≥ 0)- Returns:
- this instance for method chaining
-
maxFieldSectionSize
@Nullable public java.lang.Long maxFieldSectionSize()
Returns theMAX_FIELD_SECTION_SIZEvalue.- Returns:
- the maximum field section size, or
nullif not set
-
maxFieldSectionSize
public Http3Settings maxFieldSectionSize(long value)
Sets theMAX_FIELD_SECTION_SIZEvalue.- Parameters:
value- maximum field section size (must be ≥ 0)- Returns:
- this instance for method chaining
-
qpackBlockedStreams
@Nullable public java.lang.Long qpackBlockedStreams()
Returns theQPACK_BLOCKED_STREAMSvalue.- Returns:
- the number of blocked streams, or
nullif not set
-
qpackBlockedStreams
public Http3Settings qpackBlockedStreams(long value)
Sets theQPACK_BLOCKED_STREAMSvalue.- Parameters:
value- number of blocked streams (must be ≥ 0)- Returns:
- this instance for method chaining
-
connectProtocolEnabled
@Nullable public java.lang.Boolean connectProtocolEnabled()
Returns whether theENABLE_CONNECT_PROTOCOLsetting is enabled.- Returns:
trueif enabled,falseif disabled, ornullif not set
-
enableConnectProtocol
public Http3Settings enableConnectProtocol(boolean enabled)
Sets theENABLE_CONNECT_PROTOCOLflag.- Parameters:
enabled- whether to enable the CONNECT protocol- Returns:
- this instance for method chaining
-
h3DatagramEnabled
@Nullable public java.lang.Boolean h3DatagramEnabled()
Returns whether theH3_DATAGRAMsetting is enabled.- Returns:
trueif enabled,falseif disabled, ornullif not set
-
enableH3Datagram
public Http3Settings enableH3Datagram(boolean enabled)
Sets theH3_DATAGRAMsettings 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 anotherHttp3Settingsinstance.- Parameters:
http3Settings- the source settings (non-null)- Returns:
- this instance for method chaining
-
defaultSettings
public static Http3Settings defaultSettings()
Returns a newHttp3Settingsinstance with default values:QPACK_MAX_TABLE_CAPACITY= 0QPACK_BLOCKED_STREAMS= 0ENABLE_CONNECT_PROTOCOL= falseMAX_FIELD_SECTION_SIZE= unlimitedH3_DATAGRAM= false >
- Returns:
- a default
Http3Settingsinstance
-
iterator
public java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.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:
iteratorin interfacejava.lang.Iterable<java.util.Map.Entry<java.lang.Long,java.lang.Long>>- Returns:
- an iterator over immutable
Map.Entryobjects
-
equals
public boolean equals(java.lang.Object o)
Compares this settings object to another for equality. Two instances are equal if they contain the same key–value pairs.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the other object- Returns:
trueif equal,falseotherwise
-
hashCode
public int hashCode()
Returns the hash code of this settings object, based on its key–value pairs.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code
-
toString
public java.lang.String toString()
Returns a string representation of this settings object in the form:Http3Settings{0x1=100, 0x6=16384, 0x7=0}- Overrides:
toStringin classjava.lang.Object- Returns:
- a human-readable string representation of the settings
-
-