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 returnthisobject.
- All Known Subinterfaces:
Http2Headers, Http3Headers, SpdyHeaders, StompHeaders
- All Known Implementing Classes:
CharSequenceMap, DefaultHeaders, DefaultHeadersImpl, DefaultHttp2Headers, DefaultHttp3Headers, DefaultSpdyHeaders, DefaultStompHeaders, EmptyHeaders, EmptyHttp2Headers, ReadOnlyHttp2Headers
-
Method Summary
Modifier and TypeMethodDescriptionAdds all header names and values ofheadersto this object.Adds new headers with the specifiednameandvalues.Adds a new header with the specifiednameandvalue.Adds new headers with the specifiednameandvalues.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.booleanReturnstrueif a header with thenameexists,falseotherwise.booleanReturnstrueif a header with thenameandvalueexists,falseotherwise.booleancontainsBoolean(K name, boolean value) Returnstrueif a header with the name and value exists.booleancontainsByte(K name, byte value) Returnstrueif a header with the name and value exists.booleancontainsChar(K name, char value) Returnstrueif a header with the name and value exists.booleancontainsDouble(K name, double value) Returnstrueif a header with the name and value exists.booleancontainsFloat(K name, float value) Returnstrueif a header with the name and value exists.booleancontainsInt(K name, int value) Returnstrueif a header with the name and value exists.booleancontainsLong(K name, long value) Returnstrueif a header with the name and value exists.booleancontainsObject(K name, Object value) Returnstrueif a header with the name and value exists.booleancontainsShort(K name, short value) Returnstrueif a header with the name and value exists.booleancontainsTimeMillis(K name, long value) Returnstrueif 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 thebooleanvalue of a header with the specified name.booleangetBoolean(K name, boolean defaultValue) Returns thebooleanvalue of a header with the specified name.getBooleanAndRemove(K name) Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.booleangetBooleanAndRemove(K name, boolean defaultValue) Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.Returns thebytevalue of a header with the specified name.byteReturns thebytevalue of a header with the specified name.getByteAndRemove(K name) Returns thebytevalue of a header with the specifiednameand removes the header from this object.bytegetByteAndRemove(K name, byte defaultValue) Returns thebytevalue of a header with the specifiednameand removes the header from this object.Returns thecharvalue of a header with the specified name.charReturns thecharvalue of a header with the specified name.getCharAndRemove(K name) Returns thecharvalue of a header with the specifiednameand removes the header from this object.chargetCharAndRemove(K name, char defaultValue) Returns thecharvalue of a header with the specifiednameand removes the header from this object.Returns thedoublevalue of a header with the specified name.doubleReturns thedoublevalue of a header with the specified name.getDoubleAndRemove(K name) Returns thedoublevalue of a header with the specifiednameand removes the header from this object.doublegetDoubleAndRemove(K name, double defaultValue) Returns thedoublevalue of a header with the specifiednameand removes the header from this object.Returns thefloatvalue of a header with the specified name.floatReturns thefloatvalue of a header with the specified name.getFloatAndRemove(K name) Returns thefloatvalue of a header with the specifiednameand removes the header from this object.floatgetFloatAndRemove(K name, float defaultValue) Returns thefloatvalue of a header with the specifiednameand removes the header from this object.Returns theintvalue of a header with the specified name.intReturns theintvalue of a header with the specified name.getIntAndRemove(K name) Returns theintvalue of a header with the specifiednameand removes the header from this object.intgetIntAndRemove(K name, int defaultValue) Returns theintvalue of a header with the specifiednameand removes the header from this object.Returns thelongvalue of a header with the specified name.longReturns thelongvalue of a header with the specified name.getLongAndRemove(K name) Returns thelongvalue of a header with the specifiednameand removes the header from this object.longgetLongAndRemove(K name, long defaultValue) Returns thelongvalue of a header with the specifiednameand removes the header from this object.Returns theshortvalue of a header with the specified name.shortReturns theshortvalue of a header with the specified name.getShortAndRemove(K name) Returns theshortvalue of a header with the specifiednameand removes the header from this object.shortgetShortAndRemove(K name, short defaultValue) Returns theshortvalue of a header with the specifiednameand removes the header from this object.getTimeMillis(K name) Returns the value of a header with the specified name in milliseconds.longgetTimeMillis(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 specifiednamein milliseconds and removes the header from this object.longgetTimeMillisAndRemove(K name, long defaultValue) Returns the value of a header with the specifiednamein milliseconds and removes the header from this object.booleanisEmpty()iterator()names()Returns aSetof all header names in this object.booleanRemoves 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 thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Sets a header with the specified name and values.Sets a new header.Sets a header with the specified name and values.Set thenametovalue.setTimeMillis(K name, long value) Set thenametovalue.intsize()Returns the number of headers in this object.Methods inherited from interface 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.
nullif 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
defaultValueif 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
nullif 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
defaultValueif there is no such header
-
getAll
-
getAllAndRemove
-
getBoolean
Returns thebooleanvalue 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
booleanvalue of the first value in insertion order ornullif there is no such value or it can't be converted toboolean.
-
getBoolean
Returns thebooleanvalue 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
booleanvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toboolean.
-
getByte
Returns thebytevalue 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
bytevalue of the first value in insertion order ornullif there is no such value or it can't be converted tobyte.
-
getByte
Returns thebytevalue 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
bytevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tobyte.
-
getChar
Returns thecharvalue 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
charvalue of the first value in insertion order ornullif there is no such value or it can't be converted tochar.
-
getChar
Returns thecharvalue 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
charvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tochar.
-
getShort
Returns theshortvalue 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
shortvalue of the first value in insertion order ornullif there is no such value or it can't be converted toshort.
-
getShort
Returns theshortvalue 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
shortvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toshort.
-
getInt
Returns theintvalue 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
intvalue of the first value in insertion order ornullif there is no such value or it can't be converted toint.
-
getInt
Returns theintvalue 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
intvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toint.
-
getLong
Returns thelongvalue 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
longvalue of the first value in insertion order ornullif there is no such value or it can't be converted tolong.
-
getLong
Returns thelongvalue 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
longvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tolong.
-
getFloat
Returns thefloatvalue 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
floatvalue of the first value in insertion order ornullif there is no such value or it can't be converted tofloat.
-
getFloat
Returns thefloatvalue 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
floatvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tofloat.
-
getDouble
Returns thedoublevalue 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
doublevalue of the first value in insertion order ornullif there is no such value or it can't be converted todouble.
-
getDouble
Returns thedoublevalue 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
doublevalue of the first value in insertion order ordefaultValueif 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
nullif 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
defaultValueif there is no such value or it can't be converted to milliseconds.
-
getBooleanAndRemove
Returns thebooleanvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to retrieve- Returns:
- the
booleanvalue of the first value in insertion order ornullif there is no such value or it can't be converted toboolean.
-
getBooleanAndRemove
Returns thebooleanvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
booleanvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toboolean.
-
getByteAndRemove
Returns thebytevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
bytevalue of the first value in insertion order ornullif there is no such value or it can't be converted tobyte.
-
getByteAndRemove
Returns thebytevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
bytevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tobyte.
-
getCharAndRemove
Returns thecharvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
charvalue of the first value in insertion order ornullif there is no such value or it can't be converted tochar.
-
getCharAndRemove
Returns thecharvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
charvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tochar.
-
getShortAndRemove
Returns theshortvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
shortvalue of the first value in insertion order ornullif there is no such value or it can't be converted toshort.
-
getShortAndRemove
Returns theshortvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
shortvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toshort.
-
getIntAndRemove
Returns theintvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
intvalue of the first value in insertion order ornullif there is no such value or it can't be converted toint.
-
getIntAndRemove
Returns theintvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
intvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toint.
-
getLongAndRemove
Returns thelongvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
longvalue of the first value in insertion order ornullif there is no such value or it can't be converted tolong.
-
getLongAndRemove
Returns thelongvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
longvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tolong.
-
getFloatAndRemove
Returns thefloatvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
floatvalue of the first value in insertion order ornullif there is no such value or it can't be converted tofloat.
-
getFloatAndRemove
Returns thefloatvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
floatvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tofloat.
-
getDoubleAndRemove
Returns thedoublevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
doublevalue of the first value in insertion order ornullif there is no such value or it can't be converted todouble.
-
getDoubleAndRemove
Returns thedoublevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
doublevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted todouble.
-
getTimeMillisAndRemove
Returns the value of a header with the specifiednamein 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to retrieve- Returns:
- the milliseconds value of the first value in insertion order or
nullif there is no such value or it can't be converted to milliseconds.
-
getTimeMillisAndRemove
Returns the value of a header with the specifiednamein 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay 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
defaultValueif there is no such value or it can't be converted to milliseconds.
-
contains
Returnstrueif a header with thenameexists,falseotherwise.- Parameters:
name- the header name
-
contains
Returnstrueif a header with thenameandvalueexists,falseotherwise.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
-
containsBoolean
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsByte
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsChar
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsShort
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsInt
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsLong
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsFloat
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsDouble
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsTimeMillis
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
size
int size()Returns the number of headers in this object. -
isEmpty
boolean isEmpty() -
names
-
add
-
add
-
add
-
addObject
-
addObject
-
addObject
-
addBoolean
-
addByte
-
addChar
-
addShort
-
addInt
-
addLong
-
addFloat
-
addDouble
-
addTimeMillis
-
add
Adds all header names and values ofheadersto this object.- Returns:
this- Throws:
IllegalArgumentException- ifheaders == this.
-
set
-
set
-
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 thevalueis add, it's converted to typeT.- Parameters:
name- the header namevalue- the value of the header- Returns:
this- Throws:
NullPointerException- if eithernameorvaluebefore 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
-
setByte
-
setChar
-
setShort
-
setInt
-
setLong
-
setFloat
-
setDouble
-
setTimeMillis
-
set
-
setAll
-
remove
Removes all headers with the specifiedname.- Parameters:
name- the header name- Returns:
trueif at least one entry has been removed.
-
clear
-
iterator
-