Home / Class/ Http3Settings Class — netty Architecture

Http3Settings Class — netty Architecture

Architecture documentation for the Http3Settings class in Http3Settings.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2ee3db7b_3314_f934_9e31_df530c4e959e["Http3Settings"]
  d07686e6_a300_1762_4efe_164d4a164b93["Http3Settings.java"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|defined in| d07686e6_a300_1762_4efe_164d4a164b93
  4ba72d4e_c200_242a_5d61_19ca1bdc3fe1["Http3Settings()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 4ba72d4e_c200_242a_5d61_19ca1bdc3fe1
  028ec118_5c04_b046_e5a4_6b2a7c571834["Long()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 028ec118_5c04_b046_e5a4_6b2a7c571834
  222a501f_5b25_459d_a0c9_993747a96141["Boolean()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 222a501f_5b25_459d_a0c9_993747a96141
  d5c7bfc4_8aab_c6b8_16ad_ac12af3fb69d["iterator()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| d5c7bfc4_8aab_c6b8_16ad_ac12af3fb69d
  9dda1fa9_8f3a_d61b_68dc_086faba2e67c["equals()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 9dda1fa9_8f3a_d61b_68dc_086faba2e67c
  52774360_1c2b_2bcc_3162_44801059f487["hashCode()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 52774360_1c2b_2bcc_3162_44801059f487
  56333892_d7db_4e97_ae5c_10c27bb61ee6["String()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 56333892_d7db_4e97_ae5c_10c27bb61ee6
  1a37c31e_5f5d_822d_4351_221b3d3857f2["verifyStandardSetting()"]
  2ee3db7b_3314_f934_9e31_df530c4e959e -->|method| 1a37c31e_5f5d_822d_4351_221b3d3857f2

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3Settings.java lines 46–384

public final class Http3Settings implements Iterable<Map.Entry<Long, Long>> {

    private final LongObjectMap<Long> settings;
    final NonStandardHttp3SettingsValidator nonStandardSettingsValidator;
    private static final Long TRUE = 1L;
    private static final Long FALSE = 0L;

    /**
     * Creates a new instance
     */
    public Http3Settings() {
        // Ignore non-standard settings by default.
        this((id, v) -> false);
    }

    /**
     * Creates a new instance
     *
     * @param nonStandardSettingsValidator the {@link NonStandardHttp3SettingsValidator} to use to check if a specific
     *                                     setting that is non-standard should be supported or not.
     */
    public Http3Settings(NonStandardHttp3SettingsValidator nonStandardSettingsValidator) {
        this.settings = new LongObjectHashMap<>(Http3SettingIdentifier.values().length);
        this.nonStandardSettingsValidator = checkNotNull(nonStandardSettingsValidator, "nonStandardSettingsValidator");
    }

    /**
     * Stores a setting value for the specified identifier.
     * <p>
     * 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 <a href="https://www.rfc-editor.org/rfc/rfc9114.html#section-7.2.4-9>rfc9114</a>
     * @param key   the numeric setting identifier
     * @param value the setting value (non-null)
     * @return the previous value associated with the key, or {@code null} if none
     * @throws IllegalArgumentException if the key or value is invalid
     */
    @Nullable
    public Long put(long key, Long value) {

        // When HTTP2 settings identifier present - Throw Error
        if (Http3CodecUtils.isReservedHttp2Setting(key)) {
            throw new IllegalArgumentException("Setting is reserved for HTTP/2: " + key);
        }

        Http3SettingIdentifier identifier = Http3SettingIdentifier.fromId(key);

        if (identifier == null) {
            // When Non-Standard/Unknown settings identifier present check if we should ignore it or not.
            if (!nonStandardSettingsValidator.validate(key, value)) {
                return null;
            }
        } else {
            //Validation
            verifyStandardSetting(identifier, value);
        }

        return settings.put(key, value);
    }

    /**
     * Returns the value of the specified setting identifier.
     *
     * @param key the numeric setting identifier
     * @return the setting value, or {@code null} if not set
     */
    @Nullable
    public Long get(long key) {
        return settings.get(key);
    }

    /**
     * Returns the {@code QPACK_MAX_TABLE_CAPACITY} value.
     *
     * @return the current QPACK maximum table capacity, or {@code null} if not set
     */
    @Nullable
    public Long qpackMaxTableCapacity() {
        return get(Http3SettingIdentifier.HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY.id());
    }

Frequently Asked Questions

What is the Http3Settings class?
Http3Settings is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3Settings.java.
Where is Http3Settings defined?
Http3Settings is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3Settings.java at line 46.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free