GeezerVison is showing netty.io — Headers (Netty API Reference (4.1.141.Final))
Interface Headers<K, V, T extends Headers<K,V,T>>
- Type Parameters:
K - the type of the header name.
V - the type of the header value.
T - the type to use for return values when the intention is to return this object.
- All Superinterfaces:
Iterable<Map.Entry<K,V>>
- All Known Subinterfaces:
Http2Headers, SpdyHeaders, StompHeaders
- All Known Implementing Classes:
CharSequenceMap, DefaultHeaders, DefaultHeadersImpl, DefaultHttp2Headers, DefaultSpdyHeaders, DefaultStompHeaders, EmptyHeaders, EmptyHttp2Headers, ReadOnlyHttp2Headers
public interface Headers<K, V, T extends Headers<K,V,T>>
extends Iterable<Map.Entry<K,V>>
Common interface for Headers which represents a mapping of key to value.
Duplicate keys may be allowed by implementations.
-
Method Summary
Modifier and Type
Method
Description
Adds all header names and values of headers to this object.
Adds new headers with the specified name and values.
Adds a new header with the specified name and value.
Adds new headers with the specified name and values.
Adds a new header with the specified name and values.
Adds a new header with the specified name and values.
boolean
Returns true if a header with the name exists, false otherwise.
boolean
Returns true if a header with the name and value exists, false otherwise.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
boolean
Returns true if a header with the name and value exists.
Returns the value of a header with the specified name.
get(K name,
V defaultValue)
Returns the value of a header with the specified name.
Returns all values for the header with the specified name.
Returns all values for the header with the specified name and removes them from this object.
Returns the value of a header with the specified name and removes it from this object.
Returns the value of a header with the specified name and removes it from this object.
Returns the boolean value of a header with the specified name.
boolean
Returns the boolean value of a header with the specified name.
Returns the boolean value of a header with the specified name and removes the header from this
object.
boolean
Returns the boolean value of a header with the specified name and removes the header from this
object.
Returns the byte value of a header with the specified name.
byte
Returns the byte value of a header with the specified name.
Returns the byte value of a header with the specified name and removes the header from this
object.
byte
Returns the byte value of a header with the specified name and removes the header from this
object.
Returns the char value of a header with the specified name.
char
Returns the char value of a header with the specified name.
Returns the char value of a header with the specified name and removes the header from this
object.
char
Returns the char value of a header with the specified name and removes the header from this
object.
Returns the double value of a header with the specified name.
double
Returns the double value of a header with the specified name.
Returns the double value of a header with the specified name and removes the header from this
object.
double
Returns the double value of a header with the specified name and removes the header from this
object.
Returns the float value of a header with the specified name.
float
Returns the float value of a header with the specified name.
Returns the float value of a header with the specified name and removes the header from this
object.
float
Returns the float value of a header with the specified name and removes the header from this
object.
Returns the int value of a header with the specified name.
int
Returns the int value of a header with the specified name.
Returns the int value of a header with the specified name and removes the header from this
object.
int
Returns the int value of a header with the specified name and removes the header from this
object.
Returns the long value of a header with the specified name.
long
Returns the long value of a header with the specified name.
Returns the long value of a header with the specified name and removes the header from this
object.
long
Returns the long value of a header with the specified name and removes the header from this
object.
Returns the short value of a header with the specified name.
short
Returns the short value of a header with the specified name.
Returns the short value of a header with the specified name and removes the header from this
object.
short
Returns the short value of a header with the specified name and removes the header from this
object.
Returns the value of a header with the specified name in milliseconds.
long
Returns the value of a header with the specified name in milliseconds.
Returns the value of a header with the specified name in milliseconds and removes the header from this
object.
long
Returns the value of a header with the specified name in milliseconds and removes the header from this
object.
boolean
Returns true if size() equals 0.
Returns a Set of all header names in this object.
boolean
Removes all headers with the specified name.
Clears the current header entries and copies all header entries of the specified headers.
Sets a new header with the specified name and values.
Sets a header with the specified name and value.
Sets a header with the specified name and values.
Retains all current headers but calls set(K, V) for each entry in headers.
Sets a header with the specified name and values.
Sets a header with the specified name and values.
int
Returns the number of headers in this object.
-
Method Details
-
get
Returns the value of a header with the specified name. If there is more than one value for the specified name,
the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the first header value if the header is found.
null if there's no such header
-
get
V get(K name,
V defaultValue)
Returns the value of a header with the specified name. If there is more than one value for the specified name,
the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the first header value or
defaultValue if there is no such header
-
getAndRemove
Returns the value of a header with the specified name and removes it from this object. If there is more than
one value for the specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the first header value or
null if there is no such header
-
getAndRemove
V getAndRemove(K name,
V defaultValue)
Returns the value of a header with the specified name and removes it from this object. If there is more than
one value for the specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the first header value or
defaultValue if there is no such header
-
getAll
Returns all values for the header with the specified name. The returned List can't be modified.
- Parameters:
name - the name of the header to retrieve
- Returns:
- a
List of header values or an empty List if no values are found.
-
getAllAndRemove
List<V> getAllAndRemove(K name)
Returns all values for the header with the specified name and removes them from this object.
The returned List can't be modified.
- Parameters:
name - the name of the header to retrieve
- Returns:
- a
List of header values or an empty List if no values are found.
-
getBoolean
Returns the boolean value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
boolean value of the first value in insertion order or null if there is no such
value or it can't be converted to boolean.
-
getBoolean
boolean getBoolean(K name,
boolean defaultValue)
Returns the boolean value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
boolean value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to boolean.
-
getByte
Returns the byte value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
byte value of the first value in insertion order or null if there is no such
value or it can't be converted to byte.
-
getByte
byte getByte(K name,
byte defaultValue)
Returns the byte value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
byte value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to byte.
-
getChar
Returns the char value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
char value of the first value in insertion order or null if there is no such
value or it can't be converted to char.
-
getChar
char getChar(K name,
char defaultValue)
Returns the char value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
char value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to char.
-
getShort
Returns the short value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
short value of the first value in insertion order or null if there is no such
value or it can't be converted to short.
-
getShort
short getShort(K name,
short defaultValue)
Returns the short value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
short value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to short.
-
getInt
Returns the int value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
int value of the first value in insertion order or null if there is no such
value or it can't be converted to int.
-
getInt
int getInt(K name,
int defaultValue)
Returns the int value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
int value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to int.
-
getLong
Returns the long value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
long value of the first value in insertion order or null if there is no such
value or it can't be converted to long.
-
getLong
long getLong(K name,
long defaultValue)
Returns the long value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
long value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to long.
-
getFloat
Returns the float value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
float value of the first value in insertion order or null if there is no such
value or it can't be converted to float.
-
getFloat
float getFloat(K name,
float defaultValue)
Returns the float value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
float value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to float.
-
getDouble
Returns the double value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
double value of the first value in insertion order or null if there is no such
value or it can't be converted to double.
-
getDouble
double getDouble(K name,
double defaultValue)
Returns the double value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the
double value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to double.
-
getTimeMillis
Long getTimeMillis(K name)
Returns the value of a header with the specified name in milliseconds. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the milliseconds value of the first value in insertion order or
null if there is no such
value or it can't be converted to milliseconds.
-
getTimeMillis
long getTimeMillis(K name,
long defaultValue)
Returns the value of a header with the specified name in milliseconds. If there is more than one value for the
specified name, the first value in insertion order is returned.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue if there is no such
value or it can't be converted to milliseconds.
-
getBooleanAndRemove
Returns the boolean value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the
boolean value of the first value in insertion order or null if there is no
such value or it can't be converted to boolean.
-
getBooleanAndRemove
boolean getBooleanAndRemove(K name,
boolean defaultValue)
Returns the boolean value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
boolean value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to boolean.
-
getByteAndRemove
Byte getByteAndRemove(K name)
Returns the byte value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
byte value of the first value in insertion order or null if there is no
such value or it can't be converted to byte.
-
getByteAndRemove
byte getByteAndRemove(K name,
byte defaultValue)
Returns the byte value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
byte value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to byte.
-
getCharAndRemove
Returns the char value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
char value of the first value in insertion order or null if there is no
such value or it can't be converted to char.
-
getCharAndRemove
char getCharAndRemove(K name,
char defaultValue)
Returns the char value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
char value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to char.
-
getShortAndRemove
Short getShortAndRemove(K name)
Returns the short value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
short value of the first value in insertion order or null if there is no
such value or it can't be converted to short.
-
getShortAndRemove
short getShortAndRemove(K name,
short defaultValue)
Returns the short value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
short value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to short.
-
getIntAndRemove
Returns the int value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
int value of the first value in insertion order or null if there is no
such value or it can't be converted to int.
-
getIntAndRemove
int getIntAndRemove(K name,
int defaultValue)
Returns the int value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
int value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to int.
-
getLongAndRemove
Long getLongAndRemove(K name)
Returns the long value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
long value of the first value in insertion order or null if there is no
such value or it can't be converted to long.
-
getLongAndRemove
long getLongAndRemove(K name,
long defaultValue)
Returns the long value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
long value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to long.
-
getFloatAndRemove
Float getFloatAndRemove(K name)
Returns the float value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
float value of the first value in insertion order or null if there is no
such value or it can't be converted to float.
-
getFloatAndRemove
float getFloatAndRemove(K name,
float defaultValue)
Returns the float value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
float value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to float.
-
getDoubleAndRemove
Returns the double value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
- Returns:
- the
double value of the first value in insertion order or null if there is no
such value or it can't be converted to double.
-
getDoubleAndRemove
double getDoubleAndRemove(K name,
double defaultValue)
Returns the double value of a header with the specified name and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to search
defaultValue - the default value
- Returns:
- the
double value of the first value in insertion order or defaultValue if there is no
such value or it can't be converted to double.
-
getTimeMillisAndRemove
Long getTimeMillisAndRemove(K name)
Returns the value of a header with the specified name in milliseconds and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is
returned. In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to retrieve
- Returns:
- the milliseconds value of the first value in insertion order or
null if there is no such
value or it can't be converted to milliseconds.
-
getTimeMillisAndRemove
long getTimeMillisAndRemove(K name,
long defaultValue)
Returns the value of a header with the specified name in milliseconds and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is
returned. In any case all values for name are removed.
If an exception occurs during the translation from type T all entries with name may still
be removed.
- Parameters:
name - the name of the header to retrieve
defaultValue - the default value
- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue if there is no such
value or it can't be converted to milliseconds.
-
contains
Returns true if a header with the name exists, false otherwise.
- Parameters:
name - the header name
-
contains
boolean contains(K name,
V value)
Returns true if a header with the name and value exists, false otherwise.
The Object.equals(Object) method is used to test for equality of value.
- Parameters:
name - the header name
value - the header value of the header to find
-
containsObject
boolean containsObject(K name,
Object value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsBoolean
boolean containsBoolean(K name,
boolean value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsByte
boolean containsByte(K name,
byte value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsChar
boolean containsChar(K name,
char value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsShort
boolean containsShort(K name,
short value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsInt
boolean containsInt(K name,
int value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsLong
boolean containsLong(K name,
long value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsFloat
boolean containsFloat(K name,
float value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsDouble
boolean containsDouble(K name,
double value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
containsTimeMillis
boolean containsTimeMillis(K name,
long value)
Returns true if a header with the name and value exists.
- Parameters:
name - the header name
value - the header value
- Returns:
true if it contains it false otherwise
-
size
int size()
Returns the number of headers in this object.
-
isEmpty
boolean isEmpty()
Returns true if size() equals 0.
-
names
Returns a Set of all header names in this object. The returned Set cannot be modified.
-
add
Adds a new header with the specified name and value.
- Parameters:
name - the name of the header
value - the value of the header
- Returns:
this
-
add
Adds new headers with the specified name and values. This method is semantically equivalent to
for (T value : values) {
headers.add(name, value);
}
- Parameters:
name - the header name
values - the values of the header
- Returns:
this
-
add
T add(K name,
V... values)
Adds new headers with the specified name and values. This method is semantically equivalent to
for (T value : values) {
headers.add(name, value);
}
- Parameters:
name - the header name
values - the values of the header
- Returns:
this
-
addObject
Adds a new header. Before the value is added, it's converted to type T.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addObject
Adds a new header with the specified name and values. This method is equivalent to
for (Object v : values) {
headers.addObject(name, v);
}
- Parameters:
name - the header name
values - the value of the header
- Returns:
this
-
addObject
Adds a new header with the specified name and values. This method is equivalent to
for (Object v : values) {
headers.addObject(name, v);
}
- Parameters:
name - the header name
values - the value of the header
- Returns:
this
-
addBoolean
T addBoolean(K name,
boolean value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addByte
T addByte(K name,
byte value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addChar
T addChar(K name,
char value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addShort
T addShort(K name,
short value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addInt
T addInt(K name,
int value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addLong
T addLong(K name,
long value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addFloat
T addFloat(K name,
float value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addDouble
T addDouble(K name,
double value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
addTimeMillis
T addTimeMillis(K name,
long value)
Adds a new header.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
add
T add(Headers<? extends K, ? extends V, ?> headers)
Adds all header names and values of headers to this object.
- Returns:
this
- Throws:
IllegalArgumentException - if headers == this.
-
set
Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
-
set
Sets a new header with the specified name and values. This method is equivalent to
for (T v : values) {
headers.addObject(name, v);
}
- Parameters:
name - the header name
values - the value of the header
- Returns:
this
-
set
T set(K name,
V... values)
Sets a header with the specified name and values. Any existing headers with this name are removed. This method
is equivalent to:
headers.remove(name);
for (T v : values) {
headers.add(name, v);
}
- Parameters:
name - the header name
values - the value of the header
- Returns:
this
-
setObject
Sets a new header. Any existing headers with this name are removed. Before the value is add, it's
converted to type T.
- Parameters:
name - the header name
value - the value of the header
- Returns:
this
- Throws:
NullPointerException - if either name or value before or after its conversion is
null.
-
setObject
Sets a header with the specified name and values. Any existing headers with this name are removed. This method
is equivalent to:
headers.remove(name);
for (Object v : values) {
headers.addObject(name, v);
}
- Parameters:
name - the header name
values - the values of the header
- Returns:
this
-
setObject
Sets a header with the specified name and values. Any existing headers with this name are removed. This method
is equivalent to:
headers.remove(name);
for (Object v : values) {
headers.addObject(name, v);
}
- Parameters:
name - the header name
values - the values of the header
- Returns:
this
-
setBoolean
T setBoolean(K name,
boolean value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setByte
T setByte(K name,
byte value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setChar
T setChar(K name,
char value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setShort
T setShort(K name,
short value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setInt
T setInt(K name,
int value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setLong
T setLong(K name,
long value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setFloat
T setFloat(K name,
float value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setDouble
T setDouble(K name,
double value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
setTimeMillis
T setTimeMillis(K name,
long value)
Set the name to value. This will remove all previous values associated with name.
- Parameters:
name - The name to modify
value - The value
- Returns:
this
-
set
T set(Headers<? extends K, ? extends V, ?> headers)
Clears the current header entries and copies all header entries of the specified headers.
- Returns:
this
-
setAll
T setAll(Headers<? extends K, ? extends V, ?> headers)
Retains all current headers but calls set(K, V) for each entry in headers.
- Parameters:
headers - The headers used to set(K, V) values in this instance
- Returns:
this
-
remove
Removes all headers with the specified name.
- Parameters:
name - the header name
- Returns:
true if at least one entry has been removed.
-
clear
Removes all headers. After a call to this method size() equals 0.
- Returns:
this
-
|