Top Description Inners Fields Methods
org.eclipse.jetty.http

public Interface HttpFields

extends Iterable<HttpField>, Supplier<HttpFields>
Known Direct Subinterfaces
org.eclipse.jetty.http.HttpFields.Mutable
Known Direct Implementers
org.eclipse.jetty.http.ImmutableHttpFields, org.eclipse.jetty.http.EmptyHttpFields
Imports
java.util.ArrayList, .Collections, .EnumSet, .Enumeration, .Iterator, .List, .ListIterator, .Map, .NoSuchElementException, .Objects, .Set, java.util.function.BiFunction, .BiPredicate, .Supplier, .ToIntFunction, java.util.stream.Collectors, .Stream, .StreamSupport

An ordered collection of HttpFields that represent the HTTP headers or HTTP trailers of an HTTP request or an HTTP response.

HttpFields is immutable and typically used in server-side HTTP requests and client-side HTTP responses, while HttpFields.Mutable is mutable and typically used in server-side HTTP responses and client-side HTTP requests.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HttpFields.ImmutableHttpFields

Deprecated for removal.
public static interface
HttpFields.Mutable

A mutable version of HttpFields.

public static class
HttpFields.MutableHttpFields

Deprecated for removal.

Field Summary

Modifier and TypeField and Description
public static final HttpField
CONNECTION_CLOSE

A constant HttpField for the HTTP header:

Connection: close

public static final HttpField
CONNECTION_KEEPALIVE

A constant HttpField for the HTTP header:

Connection: keep-alive

public static final HttpField
CONTENT_LENGTH_0

A constant HttpField for the HTTP header:

Content-Length: 0

public static final HttpFields
EMPTY

A constant for an immutable and empty HttpFields.

public static final HttpField
EXPIRES_01JAN1970

A constant HttpField for the HTTP header:

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Method Summary

Modifier and TypeMethod and Description
public default HttpFields

Returns:

a new immutable copy of this HttpFields instance
asImmutable
()

Returns an immutable copy of this HttpFields instance.

public default String

Returns:

an HTTP/1.1 string representation of the HttpFields of this instance
asString
()

Returns the HTTP/1.1 string representation of the HttpFields of this instance.

public static HttpFields.Mutable

Returns:

an empty Mutable instance
build
()

Returns an empty Mutable instance.

public static HttpFields.Mutable

Returns:

an empty instance with the given initial capacity
build
(int
the initial capacity of the storage for the HttpFields
capacity
)

Returns an empty Mutable instance with the given initial capacity.

public static HttpFields.Mutable

Returns:

a new Mutable instance containing a copy of the given HttpFields
build
(HttpFields
the HttpFields to copy
fields
)

Returns a new Mutable instance containing a copy of all the HttpFields of the given HttpFields parameter.

public static HttpFields.Mutable

Returns:

a new Mutable instance containing the given HttpFields and the given replacement HttpField
build
(HttpFields
the HttpFields to copy
fields
,
HttpField
the HttpField that replaces others with the same name
replaceField
)

Returns a new Mutable instance containing a copy of all the HttpFields of the given HttpFields, replacing with the given HttpField all the fields HttpFields with the same name.

public static HttpFields.Mutable

Returns:

a new Mutable instance containing the given HttpFields without the fields with the given names
build
(HttpFields
the HttpFields to copy
fields
,
EnumSet<HttpHeader>
the names of the fields to remove
removeFields
)

Returns a new Mutable instance containing a copy of all the HttpFields of the given HttpFields, removing the HttpFields with the given names.

public default boolean

Returns:

whether this instance contains the given HttpField
contains
(HttpField
the HttpField to search for
field
)

Returns whether this instance contains the given HttpField.

public default boolean

Returns:

whether this instance contains the given HttpHeader with the given value
contains
(HttpHeader
the name of the field to search for
header
,
String
the value to search for
value
)

Returns whether this instance contains the given HttpHeader with the given value.

public default boolean

Returns:

whether this instance contains the given field name with the given value
contains
(String
the case-insensitive field name to search for
name
,
String
the field value to search for
value
)

Returns whether this instance contains the given field name with the given value.

public default boolean

Returns:

whether this instance contains the given field name
contains
(HttpHeader
the field name to search for
header
)

Returns whether this instance contains the given field name.

public default boolean

Returns:

whether this instance contains at least one of the given field names
contains
(EnumSet<HttpHeader>
the field names to search among
headers
)

Returns whether this instance contains at least one of the given field names.

public default boolean

Returns:

whether this instance contains the given field name
contains
(String
the case-insensitive field name to search for
name
)

Returns whether this instance contains the given field name.

public default boolean

Returns:

True iff the value is contained in the field value entirely or as the last element of a quoted comma separated list.
containsLast
(HttpHeader
The HttpHeader type to search for.
header
,
String
The value to search for (case-insensitive)
value
)

Look for a value as the last value in a possible multivalued field.

public static HttpFields

Returns:

a new immutable HttpFields instance with the given HttpFields
from
(HttpField...
the HttpFields to be contained in the returned instance
fields
)

Returns an immutable HttpFields instance containing the given HttpFields.

public default HttpFields

Returns:

this instance
get
()

Implements java.util.function.Supplier.get.

Supplies this instance, typically used to supply HTTP trailers.

public default String

Returns:

the raw value of the first field with the given field name, or null if no such header is present
get
(HttpHeader
the field name to search for
header
)

Returns the encoded value of the first field with the given field name, or null if no such header is present.

public default String

Returns:

the raw value of the first field with the given field name, or null if no such field is present
get
(String
the case-insensitive field name to search for
name
)

Returns the encoded value of the first field with the given field name, or null if no such field is present.

public default List<String>

Returns:

a list of all the values of all the fields with the given name, or an empty list if no such field name is present
getCSV
(HttpHeader
the field name to search for
header
,
boolean
whether the fields values should retain the quotes
keepQuotes
)

Returns all the values of all the fields with the given field name.

public default List<String>

Returns:

a list of all the values of all the fields with the given name, or an empty list if no such field name is present
getCSV
(String
the case-insensitive field name to search for
name
,
boolean
whether the fields values should retain the quotes
keepQuotes
)

Returns all the values of all the fields with the given field name.

public default long

Returns:

the value of the field as the number of milliseconds since Unix Epoch, or -1 if no such field is present
getDateField
(String
the case-insensitive field name to search for
name
)

Returns the value of a date field as the number of milliseconds since the Unix Epoch, or -1 if no such field is present.

public default long

Returns:

the value of the field as the number of milliseconds since Unix Epoch, or -1 if no such field is present
getDateField
(HttpHeader
the field name to search for
header
)

Returns the value of a date field as the number of milliseconds since the Unix Epoch, or -1 if no such field is present.

public default HttpField

Returns:

the HttpField at the given index, or null if there is no field at the given index
getField
(int
the index of the HttpField
index
)

Returns the HttpField at the given index, or null if there is no field at the given index.

public default HttpField

Returns:

the first HttpField with the given field name, or null if no such field is present
getField
(HttpHeader
the field name to search for
header
)

Returns the first HttpField with the given field name, or null if no such field is present.

public default HttpField

Returns:

the first HttpField with the given field name, or null if no such field is present
getField
(String
the case-insensitive field name to search for
name
)

Returns the first HttpField with the given field name, or null if no such field is present.

public default Enumeration<String>
getFieldNames()
Deprecated use getFieldNamesCollection()

Returns: an enumeration of field names

public default Set<String>

Returns:

a Set of the field names
getFieldNamesCollection
()

Returns a Set of the field names.

public default List<HttpField>

Returns:

a list of the HttpFields with the given field name, or an empty list if no such field name is present
getFields
(HttpHeader
the field name to search for
header
)

Returns all the HttpFields with the given field name.

public default List<HttpField>

Returns:

a list of the HttpFields with the given field name, or an empty list if no such field name is present
getFields
(String
the case-insensitive field name to search for
name
)

Returns all the HttpFields with the given field name.

private <T> List<HttpField>
getFields(T header, BiPredicate<HttpField, T> predicate)

public default String

Returns:

the raw value of the last field with the given field name, or null if no such header is present
getLast
(HttpHeader
the field name to search for
header
)

Returns the encoded value of the last field with the given field name, or null if no such header is present.

public default long

Returns:

the value of the field as a long, or -1 if no such field is present
getLongField
(String
the case-insensitive field name
name
)

Returns the value of a field as a long value, or -1 if no such field is present.

public default long

Returns:

the value of the field as a long, or -1 if no such field is present
getLongField
(HttpHeader
the field name
header
)

Returns the value of a field as a long value, or -1 if no such field is present.

public default List<String>

Returns:

a list of all the values of all the fields with the given name, split and sorted in quality order, or an empty list if no such field name is present
getQualityCSV
(HttpHeader
the field name to search for
header
)

Returns all the values of all the fields with the given name, split and sorted in quality order using QuotedQualityCSV.

public default List<String>

Returns:

a list of all the values of all the fields with the given name, split and sorted in quality order and optionally further sorted with the given function, or an empty list if no such field name is present
getQualityCSV
(HttpHeader
the field name to search for
header
,
ToIntFunction<String>
the secondary sort function, or null for no secondary sort
secondaryOrdering
)

Returns all the values of all the fields with the given name, split and sorted first in quality order and then optionally further sorted with the given function, using QuotedQualityCSV.

public default List<String>

Returns:

a list of all the values of all the fields with the given name, split and sorted in quality order, or an empty list if no such field name is present
getQualityCSV
(String
the case-insensitive field name to search for
name
)

Returns all the values of all the fields with the given name, split and sorted in quality order using QuotedQualityCSV.

public default Enumeration<String>

Returns:

an Enumeration of the encoded values of all the fields with the given name
getValues
(String
the case-insensitive field name to search for
name
)

Returns an Enumeration of the encoded values of all the fields with the given name.

public default List<String>

Returns:

a list of the encoded values of all the fields with the given name, or an empty list if no such field name is present
getValuesList
(HttpHeader
the field name to search for
header
)

Returns a list of the encoded values of all the fields with the given name.

public default List<String>

Returns:

a list of the encoded values of all the fields with the given name, or an empty list if no such field name is present
getValuesList
(String
the field name to search for
name
)

Returns a list of the encoded values of all the fields with the given name.

public default boolean

Returns:

whether the two instances are equal
isEqualTo
(HttpFields
the HttpFields instance to compare to
that
)

Returns whether this instance is equal to the given instance.

public default Iterator<HttpField>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public default ListIterator<HttpField>
listIterator()

Returns: an iterator over the HttpFields in this HttpFields.

public ListIterator<HttpField>
listIterator(int index)

Returns: an iterator over the HttpFields in this HttpFields starting at the given index.

private static long
public default int
size()

Returns: the number of HttpFields in this instance

public default Stream<HttpField>
stream()

Returns: a sequential stream of the HttpFields in this instance

Inherited from java.lang.Iterable:
forEachspliterator