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 returnthis
object.
- All Known Subinterfaces:
Http2Headers
,SpdyHeaders
,StompHeaders
- All Known Implementing Classes:
CharSequenceMap
,CombinedHttpHeaders.CombinedHttpHeadersImpl
,DefaultHeaders
,DefaultHeadersImpl
,DefaultHttp2Headers
,DefaultSpdyHeaders
,DefaultStompHeaders
,EmptyHeaders
,EmptyHttp2Headers
,ReadOnlyHttp2Headers
Headers
which represents a mapping of key to value.
Duplicate keys may be allowed by implementations.-
Method Summary
Modifier and TypeMethodDescriptionAdds all header names and values ofheaders
to this object.Adds new headers with the specifiedname
andvalues
.Adds a new header with the specifiedname
andvalue
.Adds new headers with the specifiedname
andvalues
.addBoolean
(K name, boolean value) Adds a new header.Adds a new header.Adds a new header.Adds a new header.Adds a new header.Adds a new header.Adds a new header.Adds a new header with the specified name and values.Adds a new header.Adds a new header with the specified name and values.Adds a new header.addTimeMillis
(K name, long value) Adds a new header.clear()
Removes all headers.boolean
Returnstrue
if a header with thename
exists,false
otherwise.boolean
Returnstrue
if a header with thename
andvalue
exists,false
otherwise.boolean
containsBoolean
(K name, boolean value) Returnstrue
if a header with the name and value exists.boolean
containsByte
(K name, byte value) Returnstrue
if a header with the name and value exists.boolean
containsChar
(K name, char value) Returnstrue
if a header with the name and value exists.boolean
containsDouble
(K name, double value) Returnstrue
if a header with the name and value exists.boolean
containsFloat
(K name, float value) Returnstrue
if a header with the name and value exists.boolean
containsInt
(K name, int value) Returnstrue
if a header with the name and value exists.boolean
containsLong
(K name, long value) Returnstrue
if a header with the name and value exists.boolean
containsObject
(K name, Object value) Returnstrue
if a header with the name and value exists.boolean
containsShort
(K name, short value) Returnstrue
if a header with the name and value exists.boolean
containsTimeMillis
(K name, long value) Returnstrue
if a header with the name and value exists.Returns the value of a header with the specified name.Returns the value of a header with the specified name.Returns all values for the header with the specified name.getAllAndRemove
(K name) Returns all values for the header with the specified name and removes them from this object.getAndRemove
(K name) Returns the value of a header with the specified name and removes it from this object.getAndRemove
(K name, V defaultValue) Returns the value of a header with the specified name and removes it from this object.getBoolean
(K name) Returns theboolean
value of a header with the specified name.boolean
getBoolean
(K name, boolean defaultValue) Returns theboolean
value of a header with the specified name.getBooleanAndRemove
(K name) Returns theboolean
value of a header with the specifiedname
and removes the header from this object.boolean
getBooleanAndRemove
(K name, boolean defaultValue) Returns theboolean
value of a header with the specifiedname
and removes the header from this object.Returns thebyte
value of a header with the specified name.byte
Returns thebyte
value of a header with the specified name.getByteAndRemove
(K name) Returns thebyte
value of a header with the specifiedname
and removes the header from this object.byte
getByteAndRemove
(K name, byte defaultValue) Returns thebyte
value of a header with the specifiedname
and removes the header from this object.Returns thechar
value of a header with the specified name.char
Returns thechar
value of a header with the specified name.getCharAndRemove
(K name) Returns thechar
value of a header with the specifiedname
and removes the header from this object.char
getCharAndRemove
(K name, char defaultValue) Returns thechar
value of a header with the specifiedname
and removes the header from this object.Returns thedouble
value of a header with the specified name.double
Returns thedouble
value of a header with the specified name.getDoubleAndRemove
(K name) Returns thedouble
value of a header with the specifiedname
and removes the header from this object.double
getDoubleAndRemove
(K name, double defaultValue) Returns thedouble
value of a header with the specifiedname
and removes the header from this object.Returns thefloat
value of a header with the specified name.float
Returns thefloat
value of a header with the specified name.getFloatAndRemove
(K name) Returns thefloat
value of a header with the specifiedname
and removes the header from this object.float
getFloatAndRemove
(K name, float defaultValue) Returns thefloat
value of a header with the specifiedname
and removes the header from this object.Returns theint
value of a header with the specified name.int
Returns theint
value of a header with the specified name.getIntAndRemove
(K name) Returns theint
value of a header with the specifiedname
and removes the header from this object.int
getIntAndRemove
(K name, int defaultValue) Returns theint
value of a header with the specifiedname
and removes the header from this object.Returns thelong
value of a header with the specified name.long
Returns thelong
value of a header with the specified name.getLongAndRemove
(K name) Returns thelong
value of a header with the specifiedname
and removes the header from this object.long
getLongAndRemove
(K name, long defaultValue) Returns thelong
value of a header with the specifiedname
and removes the header from this object.Returns theshort
value of a header with the specified name.short
Returns theshort
value of a header with the specified name.getShortAndRemove
(K name) Returns theshort
value of a header with the specifiedname
and removes the header from this object.short
getShortAndRemove
(K name, short defaultValue) Returns theshort
value of a header with the specifiedname
and removes the header from this object.getTimeMillis
(K name) Returns the value of a header with the specified name in milliseconds.long
getTimeMillis
(K name, long defaultValue) Returns the value of a header with the specified name in milliseconds.getTimeMillisAndRemove
(K name) Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object.long
getTimeMillisAndRemove
(K name, long defaultValue) Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object.boolean
isEmpty()
iterator()
names()
Returns aSet
of all header names in this object.boolean
Removes all headers with the specifiedname
.Clears the current header entries and copies all header entries of the specifiedheaders
.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 callsset(K, V)
for each entry inheaders
.setBoolean
(K name, boolean value) Set thename
tovalue
.Set thename
tovalue
.Set thename
tovalue
.Set thename
tovalue
.Set thename
tovalue
.Set thename
tovalue
.Set thename
tovalue
.Sets a header with the specified name and values.Sets a new header.Sets a header with the specified name and values.Set thename
tovalue
.setTimeMillis
(K name, long value) Set thename
tovalue
.int
size()
Returns the number of headers in this object.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
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 retrievedefaultValue
- 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
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 retrievedefaultValue
- 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 returnedList
can't be modified. -
getAllAndRemove
Returns all values for the header with the specified name and removes them from this object. The returnedList
can't be modified. -
getBoolean
Returns theboolean
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 ornull
if there is no such value or it can't be converted toboolean
.
-
getBoolean
Returns theboolean
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 retrievedefaultValue
- the default value- Returns:
- the
boolean
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toboolean
.
-
getByte
Returns thebyte
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 ornull
if there is no such value or it can't be converted tobyte
.
-
getByte
Returns thebyte
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 retrievedefaultValue
- the default value- Returns:
- the
byte
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tobyte
.
-
getChar
Returns thechar
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 ornull
if there is no such value or it can't be converted tochar
.
-
getChar
Returns thechar
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 retrievedefaultValue
- the default value- Returns:
- the
char
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tochar
.
-
getShort
Returns theshort
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 ornull
if there is no such value or it can't be converted toshort
.
-
getShort
Returns theshort
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 retrievedefaultValue
- the default value- Returns:
- the
short
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toshort
.
-
getInt
Returns theint
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 ornull
if there is no such value or it can't be converted toint
.
-
getInt
Returns theint
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 retrievedefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toint
.
-
getLong
Returns thelong
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 ornull
if there is no such value or it can't be converted tolong
.
-
getLong
Returns thelong
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 retrievedefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tolong
.
-
getFloat
Returns thefloat
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 ornull
if there is no such value or it can't be converted tofloat
.
-
getFloat
Returns thefloat
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 retrievedefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tofloat
.
-
getDouble
Returns thedouble
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 ornull
if there is no such value or it can't be converted todouble
.
-
getDouble
Returns thedouble
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 retrievedefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted todouble
.
-
getTimeMillis
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
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 retrievedefaultValue
- 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 theboolean
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
boolean
value of the first value in insertion order ornull
if there is no such value or it can't be converted toboolean
.
-
getBooleanAndRemove
Returns theboolean
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
boolean
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toboolean
.
-
getByteAndRemove
Returns thebyte
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
byte
value of the first value in insertion order ornull
if there is no such value or it can't be converted tobyte
.
-
getByteAndRemove
Returns thebyte
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
byte
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tobyte
.
-
getCharAndRemove
Returns thechar
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
char
value of the first value in insertion order ornull
if there is no such value or it can't be converted tochar
.
-
getCharAndRemove
Returns thechar
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
char
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tochar
.
-
getShortAndRemove
Returns theshort
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
short
value of the first value in insertion order ornull
if there is no such value or it can't be converted toshort
.
-
getShortAndRemove
Returns theshort
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
short
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toshort
.
-
getIntAndRemove
Returns theint
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
int
value of the first value in insertion order ornull
if there is no such value or it can't be converted toint
.
-
getIntAndRemove
Returns theint
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toint
.
-
getLongAndRemove
Returns thelong
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
long
value of the first value in insertion order ornull
if there is no such value or it can't be converted tolong
.
-
getLongAndRemove
Returns thelong
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tolong
.
-
getFloatAndRemove
Returns thefloat
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
float
value of the first value in insertion order ornull
if there is no such value or it can't be converted tofloat
.
-
getFloatAndRemove
Returns thefloat
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tofloat
.
-
getDoubleAndRemove
Returns thedouble
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
double
value of the first value in insertion order ornull
if there is no such value or it can't be converted todouble
.
-
getDoubleAndRemove
Returns thedouble
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted todouble
.
-
getTimeMillisAndRemove
Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object. If there is more than one value for the specifiedname
, the first value in insertion order is returned. In any case all values forname
are removed.If an exception occurs during the translation from type
T
all entries withname
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
Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object. If there is more than one value for the specifiedname
, the first value in insertion order is returned. In any case all values forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to retrievedefaultValue
- 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
Returnstrue
if a header with thename
exists,false
otherwise.- Parameters:
name
- the header name
-
contains
Returnstrue
if a header with thename
andvalue
exists,false
otherwise.The
Object.equals(Object)
method is used to test for equality ofvalue
.- Parameters:
name
- the header namevalue
- the header value of the header to find
-
containsObject
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsBoolean
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsByte
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsChar
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsShort
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsInt
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsLong
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsFloat
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsDouble
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsTimeMillis
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
size
int size()Returns the number of headers in this object. -
isEmpty
boolean isEmpty() -
names
-
add
Adds a new header with the specifiedname
andvalue
.- Parameters:
name
- the name of the headervalue
- the value of the header- Returns:
this
-
add
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
add
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
addObject
Adds a new header. Before thevalue
is added, it's converted to typeT
.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addObject
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
addObject
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
addBoolean
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addByte
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addChar
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addShort
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addInt
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addLong
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addFloat
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addDouble
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addTimeMillis
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
add
Adds all header names and values ofheaders
to this object.- Returns:
this
- Throws:
IllegalArgumentException
- ifheaders == this
.
-
set
Sets a header with the specified name and value. Any existing headers with the same name are overwritten.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
set
Sets a new header with the specified name and values. This method is equivalent tofor (T v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
set
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 namevalues
- the value of the header- Returns:
this
-
setObject
Sets a new header. Any existing headers with this name are removed. Before thevalue
is add, it's converted to typeT
.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
- Throws:
NullPointerException
- if eithername
orvalue
before or after its conversion isnull
.
-
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 namevalues
- 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 namevalues
- the values of the header- Returns:
this
-
setBoolean
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setByte
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setChar
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setShort
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setInt
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setLong
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setFloat
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setDouble
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setTimeMillis
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
set
Clears the current header entries and copies all header entries of the specifiedheaders
.- Returns:
this
-
setAll
Retains all current headers but callsset(K, V)
for each entry inheaders
.- Parameters:
headers
- The headers used toset(K, V)
values in this instance- Returns:
this
-
remove
Removes all headers with the specifiedname
.- Parameters:
name
- the header name- Returns:
true
if at least one entry has been removed.
-
clear
T clear()Removes all headers. After a call to this methodsize()
equals0
.- Returns:
this
-
iterator
-