Class Headers

java.lang.Object
com.inrupt.client.Headers

public final class Headers extends Object
A read-only view of a collection of HTTP headers.
  • Method Details

    • firstValue

      public Optional<String> firstValue(String name)
      Get the first value of a header, if it exists.
      Parameters:
      name - the header name
      Returns:
      the first value, if present
    • allValues

      public List<String> allValues(String name)
      Get all values for a header.
      Parameters:
      name - the header name
      Returns:
      the values for the header. If no values are present, an empty list will be returned
    • asMap

      public Map<String,List<String>> asMap()
      Get the header values as a Java Map.
      Returns:
      the header values
    • of

      public static Headers of(Map<String,List<String>> headers)
      Create a headers object from an existing Java Map.
      Parameters:
      headers - the headers represented as a Map
      Returns:
      the new Headers object
    • empty

      public static Headers empty()
      Create an empty headers object.
      Returns:
      the new Headers object