Class Headers

All Implemented Interfaces:
Map<String,Set<String>>
Direct Known Subclasses:
RequestHeaders, ResponseHeaders

public abstract class Headers extends CaseInsensitiveMap
A class representing the headers of a request or a response.
  • Constructor Details

    • Headers

      protected Headers()
      Default constructor
    • Headers

      protected Headers(@Nonnull Headers headers)
      Copy constructor
      Parameters:
      headers - The headers to initialize with.
  • Method Details

    • add

      public void add(@Nonnull String key, @Nonnull String value)
      Adds a header to the current request.
      Parameters:
      key - the key of the header to add.
      value - the value of the header to add.
    • tryAdd

      public boolean tryAdd(@Nonnull String key, @Nonnull String value)
      Adds a header to the current request if it was not already set
      Parameters:
      key - the key of the header to add.
      value - the value of the header to add.
      Returns:
      if the value have been added
    • remove

      public boolean remove(@Nonnull String key, @Nonnull String value)
      Removes a value from a header
      Parameters:
      key - the key of the header to remove the value from
      value - the value to remove
      Returns:
      true if the value was removed, false otherwise