Class HttpCsvHeader

java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpCsvHeader
All Implemented Interfaces:
HttpHeader
Direct Known Subclasses:
Allow, ContentLanguage, Thrown, Upgrade, Vary, Via

public class HttpCsvHeader extends HttpHeaderBean
Base for simple comma-separated token lists.
Since:
9.2.1
  • Field Details

  • Constructor Details

    • HttpCsvHeader

      protected HttpCsvHeader(String name, String value)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      value - Wire value. Can be null or empty, in which case the parsed tokens are null.
    • HttpCsvHeader

      protected HttpCsvHeader(String name, String... values)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      values - The token values. Can be null, in which case the parsed tokens are null.
    • HttpCsvHeader

      protected HttpCsvHeader(String name, Supplier<?> supplier, int lazyMode)
      Constructor with lazy value supplier.
      Parameters:
      name - Header name. Must not be null.
      supplier - The lazy value supplier. Must not be null.
      lazyMode - Either LAZY_WIRE_STRING or LAZY_TOKENS.
  • Method Details

    • of

      public static HttpCsvHeader of(String name, String wireValue)
      Creates an HttpCsvHeader by parsing the given comma-delimited wire value.
      Parameters:
      name - Header name. Must not be null.
      wireValue - Wire value. May be null or empty.
      Returns:
      A new instance. Never null.
    • of

      public static HttpCsvHeader of(String name, String... typedValues)
      Creates an HttpCsvHeader with the given typed values.
      Parameters:
      name - Header name. Must not be null.
      typedValues - The token values. May be null.
      Returns:
      A new instance. Never null.
    • asArray

      public Optional<String[]> asArray()
    • asList

      public Optional<List<String>> asList()
    • contains

      public boolean contains(String val)
    • containsIgnoreCase

      public boolean containsIgnoreCase(String val)
    • getValue

      public String getValue()
      Returns the comma-delimited wire-format value of this header.
      Specified by:
      getValue in interface HttpHeader
      Overrides:
      getValue in class HttpHeaderBean
      Returns:
      The wire value, or null if the value is unset.
    • orElse

      public String[] orElse(String[] other)
      Returns the parsed tokens of this header, or the specified default if unset.
      Parameters:
      other - The default value. Can be null to allow a null result when the header is unset.
      Returns:
      The parsed tokens, or other if the value is unset. Can be null if other is null.
    • toArray

      public String[] toArray()
      Returns the parsed tokens of this header.
      Returns:
      The parsed tokens, or null if the value is unset.
    • toList

      public List<String> toList()