Top Description Methods
io.netty5.handler.codec.http.headers

public Interface HttpHeaders

extends Iterable<Map.Entry<CharSequence, CharSequence>>
Known Direct Implementers
io.netty5.handler.codec.http.headers.DefaultHttpHeaders
Imports
io.netty5.util.AsciiString, org.jetbrains.annotations.Nullable, java.util.Iterator, .Map.Entry, .Set, .Spliterator, .Spliterators, java.util.function.BiFunction

HTTP Header Fields.

All header field names are compared in a case-insensitive manner.

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders

Returns:

this.
add
(CharSequence
the name of the header.
name
,
CharSequence
the value of the header.
value
)

Adds a new header with the specified name and value.

public HttpHeaders

Returns:

this.
add
(CharSequence
the name of the header.
name
,
Iterable<? extends CharSequence>
the values of the header.
values
)

Adds new headers with the specified name and values.

public default HttpHeaders

Returns:

this.
add
(CharSequence
the name of the header.
name
,
Iterator<? extends CharSequence>
the values of the header.
valuesItr
)

Adds new headers with the specified name and values.

public HttpHeaders

Returns:

this.
add
(CharSequence
the name of the header.
name
,
CharSequence...
the values of the header.
values
)

Adds new headers with the specified name and values.

public HttpHeaders

Returns:

this.
add
(HttpHeaders
the headers to add.
headers
)

Adds all header names and values of headers to this object.

public HttpHeaders

Returns:

this.
addCookie
(HttpCookiePair
the cookie to add.
cookie
)

Adds a cookie.

public default HttpHeaders

Returns:

this.
addCookie
(final CharSequence
the name of the cookie.
name
,
final CharSequence
the value of the cookie.
value
)

Adds a cookie with the specified name and value.

public HttpHeaders

Returns:

this.
addSetCookie
(HttpSetCookie
the cookie to add.
cookie
)

Adds a set-cookie.

public default HttpHeaders

Returns:

this.
addSetCookie
(final CharSequence
the name of the cookie.
name
,
final CharSequence
the value of the cookie.
value
)

Adds a set-cookie with the specified name and value.

public HttpHeaders

Returns:

this.
clear
()

Removes all headers.

public default boolean

Returns:

true if name exists.
contains
(final CharSequence
the header name.
name
)

Returns true if a header with the name exists, false otherwise.

public default boolean

Returns:

true if a name, value pair exists.
contains
(CharSequence
the header name.
name
,
CharSequence
the header value of the header to find.
value
)

Returns true if a header with the name and value exists, false otherwise.

public default boolean

Returns:

true if found.
containsIgnoreCase
(CharSequence
the name of the header to find.
name
,
CharSequence
the value of the header to find.
value
)

Returns true if a header with the name and value exists, false otherwise.

public HttpHeaders

Returns:

A new headers instance, with the same contents as this one.
copy
()

Create an independent copy of these HTTP headers.

public static HttpHeaders

Returns:

A new headers instance that use up as few resources as possible.
emptyHeaders
()

Create a headers instance that is expected to remain empty.

public @Nullable CharSequence

Returns:

the first header value if the header is found. null if there's no such header.
get
(CharSequence
the name of the header to retrieve.
name
)

Returns the value of a header with the specified name.

public default CharSequence

Returns:

the first header value or defaultValue if there is no such header.
get
(final CharSequence
the name of the header to retrieve.
name
,
final CharSequence
the default value.
defaultValue
)

Returns the value of a header with the specified name.

public @Nullable CharSequence

Returns:

the first header value or null if there is no such header.
getAndRemove
(CharSequence
the name of the header to retrieve.
name
)

Returns the value of a header with the specified name and removes it from this object.

public default CharSequence

Returns:

the first header value or defaultValue if there is no such header.
getAndRemove
(final CharSequence
the name of the header to retrieve.
name
,
final CharSequence
the default value.
defaultValue
)

Returns the value of a header with the specified name and removes it from this object.

public @Nullable HttpCookiePair

Returns:

a HttpSetCookie identified by name.
getCookie
(CharSequence
the cookie-name to look for.
name
)

Gets a cookie identified by name.

public default Iterable<HttpCookiePair>

Returns:

An Iterable with all the cookies.
getCookies
()

Gets all the cookies.

public default Iterable<HttpCookiePair>

Returns:

An Iterable where all the HttpSetCookies have the same name.
getCookies
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
)

Gets the cookies with the same name.

public Iterator<HttpCookiePair>

Returns:

An Iterator with all the cookies.
getCookiesIterator
()

Gets all the cookies.

public Iterator<HttpCookiePair>

Returns:

An Iterator where all the HttpSetCookies have the same name.
getCookiesIterator
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
)

Gets the cookies with the same name.

public @Nullable HttpSetCookie

Returns:

a HttpSetCookie identified by name.
getSetCookie
(CharSequence
the cookie-name to look for.
name
)

Gets a set-cookie identified by name.

public default Iterable<HttpSetCookie>

Returns:

An Iterable with all the set-cookies.
getSetCookies
()

Gets all the set-cookies.

public default Iterable<HttpSetCookie>

Returns:

An Iterable where all the HttpSetCookies have the same name.
getSetCookies
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
)

Gets the set-cookies with the same name.

public default Iterable<HttpSetCookie>

Returns:

An Iterable where all the HttpSetCookies match the parameter values.
getSetCookies
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
,
CharSequence
the domain-value of the HttpSetCookies to get. This value may be matched according to the Domain Matching algorithm.
domain
,
CharSequence
the path-av of the HttpSetCookies to get. This value may be matched according to the Path Matching algorithm.
path
)

Gets the set-cookies with the same name.

public Iterator<HttpSetCookie>

Returns:

An Iterator with all the set-cookies.
getSetCookiesIterator
()

Gets all the set-cookies.

public Iterator<HttpSetCookie>

Returns:

An Iterator where all the HttpSetCookies have the same name.
getSetCookiesIterator
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
)

Gets the set-cookies with the same name.

public Iterator<HttpSetCookie>

Returns:

An Iterator where all the HttpSetCookies match the parameter values.
getSetCookiesIterator
(CharSequence
the cookie-name of the HttpSetCookies to get.
name
,
CharSequence
the domain-value of the HttpSetCookies to get. This value may be matched according to the Domain Matching algorithm.
domain
,
CharSequence
the path-av of the HttpSetCookies to get. This value may be matched according to the Path Matching algorithm.
path
)

Gets the set-cookies with the same name.

public default boolean

Returns:

true if size() equals 0.
isEmpty
()

Returns true if size() equals 0.

public Iterator<Map.Entry<CharSequence, CharSequence>>
iterator()

Redeclares java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Set<CharSequence>

Returns:

a Set of all header names in this object. The returned Set cannot be modified.
names
()

Returns a Set of all header names in this object.

public static HttpHeaders

Returns:

A new empty headers instance.
newHeaders
()

Create a headers instance with default size hint, and all validation checks turned on.

public static HttpHeaders

Returns:

A new empty headers instance.
newHeaders
(boolean
true to validate header names, values, and cookies.
validate
)

Create a headers instance with default size hint, and all validation checks turned on.

public static HttpHeaders

Returns:

A new empty headers instance with the given configuration.
newHeaders
(int
A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.
sizeHint
,
boolean
true to validate header names.
checkNames
,
boolean
true to validate cookie contents when parsing.
checkCookies
,
boolean
true to validate header values.
checkValues
)

Create a headers instance with the given size hint, and the given validation checks turned on.

public boolean

Returns:

true if at least one entry has been removed.
remove
(CharSequence
the name of the header.
name
)

Removes all headers with the specified name.

public boolean

Returns:

true if at least one value has been removed.
remove
(CharSequence
the name of the header.
name
,
CharSequence
the value of the header to remove.
value
)

Removes specific value(s) from the specified header name.

public boolean

Returns:

true if at least one entry has been removed.
removeCookies
(CharSequence
the cookie-name of the HttpSetCookies to remove.
name
)

Removes all cookie identified by name.

public boolean

Returns:

true if at least one value has been removed.
removeIgnoreCase
(CharSequence
the name of the header.
name
,
CharSequence
the value of the header to remove.
value
)

Removes specific value(s) from the specified header name.

public boolean

Returns:

true if at least one entry has been removed.
removeSetCookies
(CharSequence
the cookie-name of the HttpSetCookies to remove.
name
)

Removes all set-cookie identified by name.

public boolean

Returns:

true if at least one entry has been removed.
removeSetCookies
(CharSequence
the cookie-name of the HttpSetCookies to remove.
name
,
CharSequence
the domain-value of the HttpSetCookies to remove. This value may be matched according to the Domain Matching algorithm.
domain
,
CharSequence
the path-av of the HttpSetCookies to remove. This value may be matched according to the Path Matching algorithm.
path
)

Removes all set-cookie identified by name.

public default HttpHeaders

Returns:

this.
replace
(final HttpHeaders
the headers used to remove names and then add new entries.
headers
)

Removes all header names contained in headers from this object, and then adds all headers contained in headers.

public HttpHeaders

Returns:

this.
set
(CharSequence
the name of the header.
name
,
CharSequence
the value of the header.
value
)

Sets a header with the specified name and value.

public HttpHeaders

Returns:

this.
set
(CharSequence
the name of the header.
name
,
Iterable<? extends CharSequence>
the values of the header.
values
)

Sets a new header with the specified name and values.

public default HttpHeaders

Returns:

this.
set
(CharSequence
the name of the header.
name
,
Iterator<? extends CharSequence>
the values of the header.
valueItr
)

Sets a new header with the specified name and values.

public default HttpHeaders

Returns:

this.
set
(CharSequence
the name of the header.
name
,
CharSequence...
the values of the header.
values
)

Sets a header with the specified name and values.

public default HttpHeaders

Returns:

this.
set
(final HttpHeaders
the headers object which contains new values.
headers
)

Clears the current header entries and copies all header entries of the specified headers object.

public int

Returns:

the number of headers in this object.
size
()

Returns the number of headers in this object.

public default Spliterator<Map.Entry<CharSequence, CharSequence>>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.
public String

Returns:

a simple String representation of this HttpHeaders.
toString
()

Returns a String representation of this HttpHeaders.

public default String

Returns:

string representation of this HttpHeaders.
toString
(BiFunction<? super CharSequence, ? super CharSequence, CharSequence>
a function that accepts the header name and value and returns the filtered value.
filter
)

Builds a string which represents all the content in this HttpHeaders in which sensitive headers can be filtered via filter.

public default Iterable<CharSequence>

Returns:

a Iterable of header values or an empty Iterable if no values are found.
values
(CharSequence
the name of the header to retrieve.
name
)

Returns all values for the header with the specified name.

public Iterator<CharSequence>

Returns:

a Iterator of header values or an empty Iterator if no values are found.
valuesIterator
(CharSequence
the name of the header to retrieve.
name
)

Returns all values for the header with the specified name.

Inherited from java.lang.Iterable:
forEach