Class Http2Settings

java.lang.Object
io.netty.util.collection.CharObjectHashMap<Long>
io.netty.handler.codec.http2.Http2Settings
All Implemented Interfaces:
CharObjectMap<Long>, Map<Character,Long>

public final class Http2Settings extends CharObjectHashMap<Long>
Settings for one endpoint in an HTTP/2 connection. Each of the values are optional as defined in the spec for the SETTINGS frame. Permits storage of arbitrary key/value pairs but provides helper methods for standard settings.
  • Field Details

    • DEFAULT_CAPACITY

      private static final int DEFAULT_CAPACITY
      Default capacity based on the number of standard settings from the HTTP/2 spec, adjusted so that adding all of the standard settings will not cause the map capacity to change.
      See Also:
    • FALSE

      private static final Long FALSE
    • TRUE

      private static final Long TRUE
  • Constructor Details

    • Http2Settings

      public Http2Settings()
    • Http2Settings

      public Http2Settings(int initialCapacity, float loadFactor)
    • Http2Settings

      public Http2Settings(int initialCapacity)
  • Method Details

    • put

      public Long put(char key, Long value)
      Adds the given setting key/value pair. For standard settings defined by the HTTP/2 spec, performs validation on the values.
      Specified by:
      put in interface CharObjectMap<Long>
      Overrides:
      put in class CharObjectHashMap<Long>
      Parameters:
      key - the key of the entry.
      value - the value of the entry.
      Returns:
      the previous value for this key or null if there was no previous mapping.
      Throws:
      IllegalArgumentException - if verification for a standard HTTP/2 setting fails.
    • headerTableSize

      public Long headerTableSize()
      Gets the SETTINGS_HEADER_TABLE_SIZE value. If unavailable, returns null.
    • headerTableSize

      public Http2Settings headerTableSize(long value)
      Sets the SETTINGS_HEADER_TABLE_SIZE value.
      Throws:
      IllegalArgumentException - if verification of the setting fails.
    • pushEnabled

      public Boolean pushEnabled()
      Gets the SETTINGS_ENABLE_PUSH value. If unavailable, returns null.
    • pushEnabled

      public Http2Settings pushEnabled(boolean enabled)
      Sets the SETTINGS_ENABLE_PUSH value.
    • maxConcurrentStreams

      public Long maxConcurrentStreams()
      Gets the SETTINGS_MAX_CONCURRENT_STREAMS value. If unavailable, returns null.
    • maxConcurrentStreams

      public Http2Settings maxConcurrentStreams(long value)
      Sets the SETTINGS_MAX_CONCURRENT_STREAMS value.
      Throws:
      IllegalArgumentException - if verification of the setting fails.
    • initialWindowSize

      public Integer initialWindowSize()
      Gets the SETTINGS_INITIAL_WINDOW_SIZE value. If unavailable, returns null.
    • initialWindowSize

      public Http2Settings initialWindowSize(int value)
      Sets the SETTINGS_INITIAL_WINDOW_SIZE value.
      Throws:
      IllegalArgumentException - if verification of the setting fails.
    • maxFrameSize

      public Integer maxFrameSize()
      Gets the SETTINGS_MAX_FRAME_SIZE value. If unavailable, returns null.
    • maxFrameSize

      public Http2Settings maxFrameSize(int value)
      Sets the SETTINGS_MAX_FRAME_SIZE value.
      Throws:
      IllegalArgumentException - if verification of the setting fails.
    • maxHeaderListSize

      public Long maxHeaderListSize()
      Gets the SETTINGS_MAX_HEADER_LIST_SIZE value. If unavailable, returns null.
    • maxHeaderListSize

      public Http2Settings maxHeaderListSize(long value)
      Sets the SETTINGS_MAX_HEADER_LIST_SIZE value.
      Throws:
      IllegalArgumentException - if verification of the setting fails.
    • connectProtocolEnabled

      public Boolean connectProtocolEnabled()
      Gets the SETTINGS_ENABLE_CONNECT_PROTOCOL value. If unavailable, returns null.
    • connectProtocolEnabled

      public Http2Settings connectProtocolEnabled(boolean enabled)
      Sets the SETTINGS_ENABLE_CONNECT_PROTOCOL value.
    • copyFrom

      public Http2Settings copyFrom(Http2Settings settings)
      Clears and then copies the given settings into this object.
    • getIntValue

      public Integer getIntValue(char key)
      A helper method that returns Long.intValue() on the return of CharObjectHashMap.get(char), if present. Note that if the range of the value exceeds Integer.MAX_VALUE, the CharObjectHashMap.get(char) method should be used instead to avoid truncation of the value.
    • verifyStandardSetting

      private static void verifyStandardSetting(int key, Long value)
    • keyToString

      protected String keyToString(char key)
      Description copied from class: CharObjectHashMap
      Helper method called by CharObjectHashMap.toString() in order to convert a single map key into a string. This is protected to allow subclasses to override the appearance of a given key.
      Overrides:
      keyToString in class CharObjectHashMap<Long>
    • defaultSettings

      public static Http2Settings defaultSettings()