Interface HttpFields

All Superinterfaces:
Iterable<HttpField>
All Known Implementing Classes:
Http3Fields, HttpFields.Immutable, HttpFields.Mutable, HttpTester.Message, HttpTester.Request, HttpTester.Response

public interface HttpFields extends Iterable<HttpField>
Interface that represents on ordered collection of HttpFields. Both HttpFields.Mutable and HttpFields.Immutable implementations are available via the static methods such as build() and from(HttpField...).
  • Field Details

  • Method Details

    • build

      static HttpFields.Mutable build()
    • build

      static HttpFields.Mutable build(int capacity)
    • build

      static HttpFields.Mutable build(HttpFields fields)
    • build

      static HttpFields.Mutable build(HttpFields fields, HttpField replaceField)
    • build

      static HttpFields.Mutable build(HttpFields fields, EnumSet<HttpHeader> removeFields)
    • from

      static HttpFields.Immutable from(HttpField... fields)
    • asImmutable

      HttpFields.Immutable asImmutable()
    • asString

      default String asString()
    • contains

      default boolean contains(HttpField field)
    • contains

      default boolean contains(HttpHeader header, String value)
    • contains

      default boolean contains(String name, String value)
    • contains

      default boolean contains(HttpHeader header)
    • contains

      default boolean contains(EnumSet<HttpHeader> headers)
    • contains

      default boolean contains(String name)
    • get

      default String get(HttpHeader header)
    • get

      default String get(String header)
    • getCSV

      default List<String> getCSV(HttpHeader header, boolean keepQuotes)
      Get multiple field values of the same name, split as a QuotedCSV
      Parameters:
      header - The header
      keepQuotes - True if the fields are kept quoted
      Returns:
      List the values with OWS stripped
    • getCSV

      default List<String> getCSV(String name, boolean keepQuotes)
      Get multiple field values of the same name as a QuotedCSV
      Parameters:
      name - the case-insensitive field name
      keepQuotes - True if the fields are kept quoted
      Returns:
      List the values with OWS stripped
    • getDateField

      default long getDateField(String name)
      Get a header as a date value. Returns the value of a date field, or -1 if not found. The case of the field name is ignored.
      Parameters:
      name - the case-insensitive field name
      Returns:
      the value of the field as a number of milliseconds since unix epoch
    • getField

      HttpField getField(int index)
      Get a Field by index.
      Parameters:
      index - the field index
      Returns:
      A Field value or null if the Field value has not been set
    • getField

      default HttpField getField(HttpHeader header)
    • getField

      default HttpField getField(String name)
    • getFieldNames

      default Enumeration<String> getFieldNames()
      Get enumeration of header _names. Returns an enumeration of strings representing the header _names for this request.
      Returns:
      an enumeration of field names
    • getFieldNamesCollection

      default Set<String> getFieldNamesCollection()
      Get Set of header names.
      Returns:
      the unique set of field names.
    • getFields

      default List<HttpField> getFields(HttpHeader header)
      Get multiple fields of the same header
      Parameters:
      header - the header
      Returns:
      List the fields
    • getFields

      default List<HttpField> getFields(String name)
    • getLongField

      default long getLongField(String name) throws NumberFormatException
      Get a header as an long value. Returns the value of an integer field or -1 if not found. The case of the field name is ignored.
      Parameters:
      name - the case-insensitive field name
      Returns:
      the value of the field as a long
      Throws:
      NumberFormatException - If bad long found
    • getLongField

      default long getLongField(HttpHeader header) throws NumberFormatException
      Get a header as an long value. Returns the value of an integer field or -1 if not found. The case of the field name is ignored.
      Parameters:
      header - the header type
      Returns:
      the value of the field as a long
      Throws:
      NumberFormatException - If bad long found
    • getQualityCSV

      default List<String> getQualityCSV(HttpHeader header)
      Get multiple field values of the same name, split and sorted as a QuotedQualityCSV
      Parameters:
      header - The header
      Returns:
      List the values in quality order with the q param and OWS stripped
    • getQualityCSV

      default List<String> getQualityCSV(HttpHeader header, ToIntFunction<String> secondaryOrdering)
      Get multiple field values of the same name, split and sorted as a QuotedQualityCSV
      Parameters:
      header - The header
      secondaryOrdering - Function to apply an ordering other than specified by quality
      Returns:
      List the values in quality order with the q param and OWS stripped
    • getQualityCSV

      default List<String> getQualityCSV(String name)
      Get multiple field values of the same name, split and sorted as a QuotedQualityCSV
      Parameters:
      name - the case-insensitive field name
      Returns:
      List the values in quality order with the q param and OWS stripped
    • getValues

      default Enumeration<String> getValues(String name)
      Get multi headers
      Parameters:
      name - the case-insensitive field name
      Returns:
      Enumeration of the values
    • getValuesList

      default List<String> getValuesList(HttpHeader header)
      Get multiple field values of the same name
      Parameters:
      header - the header
      Returns:
      List the values
    • getValuesList

      default List<String> getValuesList(String name)
      Get multiple header of the same name
      Parameters:
      name - the case-insensitive field name
      Returns:
      List the header values
    • isEqualTo

      default boolean isEqualTo(HttpFields that)
    • size

      int size()
    • stream

      Stream<HttpField> stream()