Class ReadOnlyHeaders

java.lang.Object
io.helidon.common.http.ReadOnlyParameters
io.helidon.common.http.ReadOnlyHeaders
All Implemented Interfaces:
Headers, Parameters, Iterable<Map.Entry<String,List<String>>>
Direct Known Subclasses:
ReadableBodyPartHeaders

public class ReadOnlyHeaders extends ReadOnlyParameters implements Headers
An immutable implementation of Headers.

Factories for multi-maps passed to superclass constructors use TreeSet instead of a concurrency-tolerant implementation because this is a read-only implementation.

See Also:
  • Constructor Details

    • ReadOnlyHeaders

      protected ReadOnlyHeaders(Map<String,List<String>> data)
      Returns an immutable deep copy of the provided multimap.
      Parameters:
      data - multi-map data to copy.
    • ReadOnlyHeaders

      protected ReadOnlyHeaders(Parameters parameters)
      Returns an immutable deep copy of the provided Parameters instance.
      Parameters:
      parameters - parameters to copy.
  • Method Details

    • empty

      public static ReadOnlyHeaders empty()
      Returns an empty and immutable singleton.
      Returns:
      the headers singleton (empty and immutable)
    • create

      protected static ReadOnlyHeaders create(Map<String,List<String>> initialContent)
      Creates a new ReadOnlyHeaders instance with the specified multi-map contents as initial contents.
      Parameters:
      initialContent - multi-map contains name/values-list pairs for the initial content
      Returns:
      new instance with the specified initial content
    • create

      @Deprecated(since="3.0.3", forRemoval=true) public static ReadOnlyHeaders create(Parameters initialContent)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use create(Headers) instead, passing Headers instead of Parameters.
      Creates a new instance populated with the specified Parameters settings.
      Parameters:
      initialContent - Parameters to be used as the initial content for the new instance
      Returns:
      new instance with specified initial content
    • create

      public static ReadOnlyHeaders create(Headers initialContent)
      Creates a new instance populated with the specified Headers settings.
      Parameters:
      initialContent - Headers to be used as the initial content for the new instance
      Returns:
      new instance with specified initial content
    • emptyMap

      protected Map<String,List<String>> emptyMap()
      Description copied from class: ReadOnlyParameters
      Creates an empty Map suitable (once populated) for read-only access.
      Overrides:
      emptyMap in class ReadOnlyParameters
      Returns:
      empty Map
    • emptyMapForCopy

      protected Map<String,List<String>> emptyMapForCopy()
      Description copied from class: ReadOnlyParameters
      Creates an empty Map suitable (once populated) for read-only access, pre-sized as specified.
      Overrides:
      emptyMapForCopy in class ReadOnlyParameters
      Returns:
      empty Map, possibly pre-sized as indicated