public final class ReadOnlyHttp2Headers extends Object implements Http2Headers
Http2Headers
which only supports read-only methods.
Any array passed to this class may be used directly in the underlying data structures of this class. If these arrays may be modified it is the caller's responsibility to supply this class with a copy of the array.
This may be a good alternative to DefaultHttp2Headers
if your have a fixed set of headers which will not
change.
Http2Headers.PseudoHeaderName
Modifier and Type | Method and Description |
---|---|
Http2Headers |
add(CharSequence name,
CharSequence... values)
Adds new headers with the specified
name and values . |
Http2Headers |
add(CharSequence name,
CharSequence value)
Adds a new header with the specified
name and value . |
Http2Headers |
add(CharSequence name,
Iterable<? extends CharSequence> values)
Adds new headers with the specified
name and values . |
Http2Headers |
add(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Adds all header names and values of
headers to this object. |
Http2Headers |
addBoolean(CharSequence name,
boolean value)
Adds a new header.
|
Http2Headers |
addByte(CharSequence name,
byte value)
Adds a new header.
|
Http2Headers |
addChar(CharSequence name,
char value)
Adds a new header.
|
Http2Headers |
addDouble(CharSequence name,
double value)
Adds a new header.
|
Http2Headers |
addFloat(CharSequence name,
float value)
Adds a new header.
|
Http2Headers |
addInt(CharSequence name,
int value)
Adds a new header.
|
Http2Headers |
addLong(CharSequence name,
long value)
Adds a new header.
|
Http2Headers |
addObject(CharSequence name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
Http2Headers |
addObject(CharSequence name,
Object... values)
Adds a new header with the specified name and values.
|
Http2Headers |
addObject(CharSequence name,
Object value)
Adds a new header.
|
Http2Headers |
addShort(CharSequence name,
short value)
Adds a new header.
|
Http2Headers |
addTimeMillis(CharSequence name,
long value)
Adds a new header.
|
CharSequence |
authority()
Gets the
Http2Headers.PseudoHeaderName.AUTHORITY header or null if there is no such header |
Http2Headers |
authority(CharSequence value)
Sets the
Http2Headers.PseudoHeaderName.AUTHORITY header or null if there is no such header |
Http2Headers |
clear()
Removes all headers.
|
static ReadOnlyHttp2Headers |
clientHeaders(boolean validateHeaders,
AsciiString method,
AsciiString path,
AsciiString scheme,
AsciiString authority,
AsciiString... otherHeaders)
Create a new read only representation of headers used by clients.
|
boolean |
contains(CharSequence name)
Returns
true if a header with the name exists, false otherwise. |
boolean |
contains(CharSequence name,
CharSequence value)
Returns
true if a header with the name and value exists, false otherwise. |
boolean |
containsBoolean(CharSequence name,
boolean value)
Returns
true if a header with the name and value exists. |
boolean |
containsByte(CharSequence name,
byte value)
Returns
true if a header with the name and value exists. |
boolean |
containsChar(CharSequence name,
char value)
Returns
true if a header with the name and value exists. |
boolean |
containsDouble(CharSequence name,
double value)
Returns
true if a header with the name and value exists. |
boolean |
containsFloat(CharSequence name,
float value)
Returns
true if a header with the name and value exists. |
boolean |
containsInt(CharSequence name,
int value)
Returns
true if a header with the name and value exists. |
boolean |
containsLong(CharSequence name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(CharSequence name,
Object value)
Returns
true if a header with the name and value exists. |
boolean |
containsShort(CharSequence name,
short value)
Returns
true if a header with the name and value exists. |
boolean |
containsTimeMillis(CharSequence name,
long value)
Returns
true if a header with the name and value exists. |
CharSequence |
get(CharSequence name)
Returns the value of a header with the specified name.
|
CharSequence |
get(CharSequence name,
CharSequence defaultValue)
Returns the value of a header with the specified name.
|
List<CharSequence> |
getAll(CharSequence name)
Returns all values for the header with the specified name.
|
List<CharSequence> |
getAllAndRemove(CharSequence name)
Returns all values for the header with the specified name and removes them from this object.
|
CharSequence |
getAndRemove(CharSequence name)
Returns the value of a header with the specified name and removes it from this object.
|
CharSequence |
getAndRemove(CharSequence name,
CharSequence defaultValue)
Returns the value of a header with the specified name and removes it from this object.
|
Boolean |
getBoolean(CharSequence name)
Returns the
boolean value of a header with the specified name. |
boolean |
getBoolean(CharSequence name,
boolean defaultValue)
Returns the
boolean value of a header with the specified name. |
Boolean |
getBooleanAndRemove(CharSequence name)
Returns the
boolean value of a header with the specified name and removes the header from this
object. |
boolean |
getBooleanAndRemove(CharSequence name,
boolean defaultValue)
Returns the
boolean value of a header with the specified name and removes the header from this
object. |
Byte |
getByte(CharSequence name)
Returns the
byte value of a header with the specified name. |
byte |
getByte(CharSequence name,
byte defaultValue)
Returns the
byte value of a header with the specified name. |
Byte |
getByteAndRemove(CharSequence name)
Returns the
byte value of a header with the specified name and removes the header from this
object. |
byte |
getByteAndRemove(CharSequence name,
byte defaultValue)
Returns the
byte value of a header with the specified name and removes the header from this
object. |
Character |
getChar(CharSequence name)
Returns the
char value of a header with the specified name. |
char |
getChar(CharSequence name,
char defaultValue)
Returns the
char value of a header with the specified name. |
Character |
getCharAndRemove(CharSequence name)
Returns the
char value of a header with the specified name and removes the header from this
object. |
char |
getCharAndRemove(CharSequence name,
char defaultValue)
Returns the
char value of a header with the specified name and removes the header from this
object. |
Double |
getDouble(CharSequence name)
Returns the
double value of a header with the specified name. |
double |
getDouble(CharSequence name,
double defaultValue)
Returns the
double value of a header with the specified name. |
Double |
getDoubleAndRemove(CharSequence name)
Returns the
double value of a header with the specified name and removes the header from this
object. |
double |
getDoubleAndRemove(CharSequence name,
double defaultValue)
Returns the
double value of a header with the specified name and removes the header from this
object. |
Float |
getFloat(CharSequence name)
Returns the
float value of a header with the specified name. |
float |
getFloat(CharSequence name,
float defaultValue)
Returns the
float value of a header with the specified name. |
Float |
getFloatAndRemove(CharSequence name)
Returns the
float value of a header with the specified name and removes the header from this
object. |
float |
getFloatAndRemove(CharSequence name,
float defaultValue)
Returns the
float value of a header with the specified name and removes the header from this
object. |
Integer |
getInt(CharSequence name)
Returns the
int value of a header with the specified name. |
int |
getInt(CharSequence name,
int defaultValue)
Returns the
int value of a header with the specified name. |
Integer |
getIntAndRemove(CharSequence name)
Returns the
int value of a header with the specified name and removes the header from this
object. |
int |
getIntAndRemove(CharSequence name,
int defaultValue)
Returns the
int value of a header with the specified name and removes the header from this
object. |
Long |
getLong(CharSequence name)
Returns the
long value of a header with the specified name. |
long |
getLong(CharSequence name,
long defaultValue)
Returns the
long value of a header with the specified name. |
Long |
getLongAndRemove(CharSequence name)
Returns the
long value of a header with the specified name and removes the header from this
object. |
long |
getLongAndRemove(CharSequence name,
long defaultValue)
Returns the
long value of a header with the specified name and removes the header from this
object. |
Short |
getShort(CharSequence name)
Returns the
short value of a header with the specified name. |
short |
getShort(CharSequence name,
short defaultValue)
Returns the
short value of a header with the specified name. |
Short |
getShortAndRemove(CharSequence name)
Returns the
short value of a header with the specified name and removes the header from this
object. |
short |
getShortAndRemove(CharSequence name,
short defaultValue)
Returns the
short value of a header with the specified name and removes the header from this
object. |
Long |
getTimeMillis(CharSequence name)
Returns the value of a header with the specified name in milliseconds.
|
long |
getTimeMillis(CharSequence name,
long defaultValue)
Returns the value of a header with the specified name in milliseconds.
|
Long |
getTimeMillisAndRemove(CharSequence name)
Returns the value of a header with the specified
name in milliseconds and removes the header from this
object. |
long |
getTimeMillisAndRemove(CharSequence name,
long defaultValue)
Returns the value of a header with the specified
name in milliseconds and removes the header from this
object. |
boolean |
isEmpty()
|
Iterator<Map.Entry<CharSequence,CharSequence>> |
iterator()
Returns an iterator over all HTTP/2 headers.
|
CharSequence |
method()
Gets the
Http2Headers.PseudoHeaderName.METHOD header or null if there is no such header |
Http2Headers |
method(CharSequence value)
Sets the
Http2Headers.PseudoHeaderName.METHOD header or null if there is no such header |
Set<CharSequence> |
names()
Returns a
Set of all header names in this object. |
CharSequence |
path()
Gets the
Http2Headers.PseudoHeaderName.PATH header or null if there is no such header |
Http2Headers |
path(CharSequence value)
Sets the
Http2Headers.PseudoHeaderName.PATH header or null if there is no such header |
boolean |
remove(CharSequence name)
Removes all headers with the specified
name . |
CharSequence |
scheme()
Gets the
Http2Headers.PseudoHeaderName.SCHEME header or null if there is no such header |
Http2Headers |
scheme(CharSequence value)
Sets the
Http2Headers.PseudoHeaderName.SCHEME header if there is no such header |
static ReadOnlyHttp2Headers |
serverHeaders(boolean validateHeaders,
AsciiString status,
AsciiString... otherHeaders)
Create a new read only representation of headers used by servers.
|
Http2Headers |
set(CharSequence name,
CharSequence... values)
Sets a header with the specified name and values.
|
Http2Headers |
set(CharSequence name,
CharSequence value)
Sets a header with the specified name and value.
|
Http2Headers |
set(CharSequence name,
Iterable<? extends CharSequence> values)
Sets a new header with the specified name and values.
|
Http2Headers |
set(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Clears the current header entries and copies all header entries of the specified
headers . |
Http2Headers |
setAll(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Retains all current headers but calls
#set(K, V) for each entry in headers . |
Http2Headers |
setBoolean(CharSequence name,
boolean value)
Set the
name to value . |
Http2Headers |
setByte(CharSequence name,
byte value)
Set the
name to value . |
Http2Headers |
setChar(CharSequence name,
char value)
Set the
name to value . |
Http2Headers |
setDouble(CharSequence name,
double value)
Set the
name to value . |
Http2Headers |
setFloat(CharSequence name,
float value)
Set the
name to value . |
Http2Headers |
setInt(CharSequence name,
int value)
Set the
name to value . |
Http2Headers |
setLong(CharSequence name,
long value)
Set the
name to value . |
Http2Headers |
setObject(CharSequence name,
Iterable<?> values)
Sets a header with the specified name and values.
|
Http2Headers |
setObject(CharSequence name,
Object... values)
Sets a header with the specified name and values.
|
Http2Headers |
setObject(CharSequence name,
Object value)
Sets a new header.
|
Http2Headers |
setShort(CharSequence name,
short value)
Set the
name to value . |
Http2Headers |
setTimeMillis(CharSequence name,
long value)
Set the
name to value . |
int |
size()
Returns the number of headers in this object.
|
CharSequence |
status()
Gets the
Http2Headers.PseudoHeaderName.STATUS header or null if there is no such header |
Http2Headers |
status(CharSequence value)
Sets the
Http2Headers.PseudoHeaderName.STATUS header or null if there is no such header |
String |
toString() |
static ReadOnlyHttp2Headers |
trailers(boolean validateHeaders,
AsciiString... otherHeaders)
Used to create read only object designed to represent trailers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static ReadOnlyHttp2Headers trailers(boolean validateHeaders, AsciiString... otherHeaders)
If this is used for a purpose other than trailers you may violate the header serialization ordering defined by RFC 7540, 8.1.2.1.
validateHeaders
- true
will run validation on each header name/value pair to ensure protocol
compliance.otherHeaders
- A an array of key:value pairs. Must not contain any
pseudo headers
or null
names/values.
A copy will NOT be made of this array. If the contents of this array
may be modified externally you are responsible for passing in a copy.public static ReadOnlyHttp2Headers clientHeaders(boolean validateHeaders, AsciiString method, AsciiString path, AsciiString scheme, AsciiString authority, AsciiString... otherHeaders)
validateHeaders
- true
will run validation on each header name/value pair to ensure protocol
compliance.method
- The value for PseudoHeaderName#METHOD
.path
- The value for PseudoHeaderName#PATH
.scheme
- The value for PseudoHeaderName#SCHEME
.authority
- The value for PseudoHeaderName#AUTHORITY
.otherHeaders
- A an array of key:value pairs. Must not contain any
pseudo headers
or null
names/values.
A copy will NOT be made of this array. If the contents of this array
may be modified externally you are responsible for passing in a copy.public static ReadOnlyHttp2Headers serverHeaders(boolean validateHeaders, AsciiString status, AsciiString... otherHeaders)
validateHeaders
- true
will run validation on each header name/value pair to ensure protocol
compliance.status
- The value for PseudoHeaderName#STATUS
.otherHeaders
- A an array of key:value pairs. Must not contain any
pseudo headers
or null
names/values.
A copy will NOT be made of this array. If the contents of this array
may be modified externally you are responsible for passing in a copy.public CharSequence get(CharSequence name)
Headers
get
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievenull
if there's no such headerpublic CharSequence get(CharSequence name, CharSequence defaultValue)
Headers
get
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such headerpublic CharSequence getAndRemove(CharSequence name)
Headers
getAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievenull
if there is no such headerpublic CharSequence getAndRemove(CharSequence name, CharSequence defaultValue)
Headers
getAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such headerpublic List<CharSequence> getAll(CharSequence name)
Headers
List
can't be modified.getAll
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveList
of header values or an empty List
if no values are found.public List<CharSequence> getAllAndRemove(CharSequence name)
Headers
List
can't be modified.getAllAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveList
of header values or an empty List
if no values are found.public Boolean getBoolean(CharSequence name)
Headers
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.getBoolean
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveboolean
value of the first value in insertion order or null
if there is no such
value or it can't be converted to boolean
.public boolean getBoolean(CharSequence name, boolean defaultValue)
Headers
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.getBoolean
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valueboolean
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to boolean
.public Byte getByte(CharSequence name)
Headers
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.getByte
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievebyte
value of the first value in insertion order or null
if there is no such
value or it can't be converted to byte
.public byte getByte(CharSequence name, byte defaultValue)
Headers
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.getByte
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuebyte
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to byte
.public Character getChar(CharSequence name)
Headers
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.getChar
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievechar
value of the first value in insertion order or null
if there is no such
value or it can't be converted to char
.public char getChar(CharSequence name, char defaultValue)
Headers
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.getChar
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuechar
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to char
.public Short getShort(CharSequence name)
Headers
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.getShort
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveshort
value of the first value in insertion order or null
if there is no such
value or it can't be converted to short
.public short getShort(CharSequence name, short defaultValue)
Headers
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.getShort
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valueshort
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to short
.public Integer getInt(CharSequence name)
Headers
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.getInt
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveint
value of the first value in insertion order or null
if there is no such
value or it can't be converted to int
.public int getInt(CharSequence name, int defaultValue)
Headers
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.getInt
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valueint
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to int
.public Long getLong(CharSequence name)
Headers
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.getLong
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievelong
value of the first value in insertion order or null
if there is no such
value or it can't be converted to long
.public long getLong(CharSequence name, long defaultValue)
Headers
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.getLong
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuelong
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to long
.public Float getFloat(CharSequence name)
Headers
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.getFloat
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievefloat
value of the first value in insertion order or null
if there is no such
value or it can't be converted to float
.public float getFloat(CharSequence name, float defaultValue)
Headers
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.getFloat
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuefloat
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to float
.public Double getDouble(CharSequence name)
Headers
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.getDouble
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedouble
value of the first value in insertion order or null
if there is no such
value or it can't be converted to double
.public double getDouble(CharSequence name, double defaultValue)
Headers
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.getDouble
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuedouble
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to double
.public Long getTimeMillis(CharSequence name)
Headers
getTimeMillis
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievenull
if there is no such
value or it can't be converted to milliseconds.public long getTimeMillis(CharSequence name, long defaultValue)
Headers
getTimeMillis
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such
value or it can't be converted to milliseconds.public Boolean getBooleanAndRemove(CharSequence name)
Headers
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.
getBooleanAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrieveboolean
value of the first value in insertion order or null
if there is no
such value or it can't be converted to boolean
.public boolean getBooleanAndRemove(CharSequence name, boolean defaultValue)
Headers
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.
getBooleanAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valueboolean
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to boolean
.public Byte getByteAndRemove(CharSequence name)
Headers
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.
getByteAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchbyte
value of the first value in insertion order or null
if there is no
such value or it can't be converted to byte
.public byte getByteAndRemove(CharSequence name, byte defaultValue)
Headers
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.
getByteAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valuebyte
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to byte
.public Character getCharAndRemove(CharSequence name)
Headers
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.
getCharAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchchar
value of the first value in insertion order or null
if there is no
such value or it can't be converted to char
.public char getCharAndRemove(CharSequence name, char defaultValue)
Headers
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.
getCharAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valuechar
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to char
.public Short getShortAndRemove(CharSequence name)
Headers
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.
getShortAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchshort
value of the first value in insertion order or null
if there is no
such value or it can't be converted to short
.public short getShortAndRemove(CharSequence name, short defaultValue)
Headers
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.
getShortAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valueshort
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to short
.public Integer getIntAndRemove(CharSequence name)
Headers
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.
getIntAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchint
value of the first value in insertion order or null
if there is no
such value or it can't be converted to int
.public int getIntAndRemove(CharSequence name, int defaultValue)
Headers
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.
getIntAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valueint
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to int
.public Long getLongAndRemove(CharSequence name)
Headers
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.
getLongAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchlong
value of the first value in insertion order or null
if there is no
such value or it can't be converted to long
.public long getLongAndRemove(CharSequence name, long defaultValue)
Headers
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.
getLongAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valuelong
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to long
.public Float getFloatAndRemove(CharSequence name)
Headers
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.
getFloatAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchfloat
value of the first value in insertion order or null
if there is no
such value or it can't be converted to float
.public float getFloatAndRemove(CharSequence name, float defaultValue)
Headers
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.
getFloatAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valuefloat
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to float
.public Double getDoubleAndRemove(CharSequence name)
Headers
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.
getDoubleAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdouble
value of the first value in insertion order or null
if there is no
such value or it can't be converted to double
.public double getDoubleAndRemove(CharSequence name, double defaultValue)
Headers
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.
getDoubleAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to searchdefaultValue
- the default valuedouble
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to double
.public Long getTimeMillisAndRemove(CharSequence name)
Headers
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.
getTimeMillisAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievenull
if there is no such
value or it can't be converted to milliseconds.public long getTimeMillisAndRemove(CharSequence name, long defaultValue)
Headers
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.
getTimeMillisAndRemove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such
value or it can't be converted to milliseconds.public boolean contains(CharSequence name)
Headers
true
if a header with the name
exists, false
otherwise.contains
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namepublic boolean contains(CharSequence name, CharSequence value)
Headers
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
.
contains
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header value of the header to findpublic boolean containsObject(CharSequence name, Object value)
Headers
true
if a header with the name and value exists.containsObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsBoolean(CharSequence name, boolean value)
Headers
true
if a header with the name and value exists.containsBoolean
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsByte(CharSequence name, byte value)
Headers
true
if a header with the name and value exists.containsByte
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsChar(CharSequence name, char value)
Headers
true
if a header with the name and value exists.containsChar
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsShort(CharSequence name, short value)
Headers
true
if a header with the name and value exists.containsShort
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsInt(CharSequence name, int value)
Headers
true
if a header with the name and value exists.containsInt
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsLong(CharSequence name, long value)
Headers
true
if a header with the name and value exists.containsLong
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsFloat(CharSequence name, float value)
Headers
true
if a header with the name and value exists.containsFloat
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsDouble(CharSequence name, double value)
Headers
true
if a header with the name and value exists.containsDouble
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic boolean containsTimeMillis(CharSequence name, long value)
Headers
true
if a header with the name and value exists.containsTimeMillis
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the header valuetrue
if it contains it false
otherwisepublic int size()
Headers
size
in interface Headers<CharSequence,CharSequence,Http2Headers>
public boolean isEmpty()
Headers
isEmpty
in interface Headers<CharSequence,CharSequence,Http2Headers>
public Set<CharSequence> names()
Headers
names
in interface Headers<CharSequence,CharSequence,Http2Headers>
public Http2Headers add(CharSequence name, CharSequence value)
Headers
name
and value
.add
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the name of the headervalue
- the value of the headerthis
public Http2Headers add(CharSequence name, Iterable<? extends CharSequence> values)
Headers
name
and values
. This method is semantically equivalent to
for (T value : values) { headers.add(name, value); }
add
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the values of the headerthis
public Http2Headers add(CharSequence name, CharSequence... values)
Headers
name
and values
. This method is semantically equivalent to
for (T value : values) { headers.add(name, value); }
add
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the values of the headerthis
public Http2Headers addObject(CharSequence name, Object value)
Headers
value
is added, it's converted to type T
.addObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addObject(CharSequence name, Iterable<?> values)
Headers
for (Object v : values) { headers.addObject(name, v); }
addObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the value of the headerthis
public Http2Headers addObject(CharSequence name, Object... values)
Headers
for (Object v : values) { headers.addObject(name, v); }
addObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the value of the headerthis
public Http2Headers addBoolean(CharSequence name, boolean value)
Headers
addBoolean
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addByte(CharSequence name, byte value)
Headers
addByte
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addChar(CharSequence name, char value)
Headers
addChar
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addShort(CharSequence name, short value)
Headers
addShort
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addInt(CharSequence name, int value)
Headers
addInt
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addLong(CharSequence name, long value)
Headers
addLong
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addFloat(CharSequence name, float value)
Headers
addFloat
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addDouble(CharSequence name, double value)
Headers
addDouble
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers addTimeMillis(CharSequence name, long value)
Headers
addTimeMillis
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers add(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Headers
headers
to this object.add
in interface Headers<CharSequence,CharSequence,Http2Headers>
this
public Http2Headers set(CharSequence name, CharSequence value)
Headers
set
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers set(CharSequence name, Iterable<? extends CharSequence> values)
Headers
for (T v : values) { headers.addObject(name, v); }
set
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the value of the headerthis
public Http2Headers set(CharSequence name, CharSequence... values)
Headers
headers.remove(name); for (T v : values) { headers.add(name, v); }
set
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the value of the headerthis
public Http2Headers setObject(CharSequence name, Object value)
Headers
value
is add, it's
converted to type T
.setObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalue
- the value of the headerthis
public Http2Headers setObject(CharSequence name, Iterable<?> values)
Headers
headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
setObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the values of the headerthis
public Http2Headers setObject(CharSequence name, Object... values)
Headers
headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
setObject
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header namevalues
- the values of the headerthis
public Http2Headers setBoolean(CharSequence name, boolean value)
Headers
name
to value
. This will remove all previous values associated with name
.setBoolean
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setByte(CharSequence name, byte value)
Headers
name
to value
. This will remove all previous values associated with name
.setByte
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setChar(CharSequence name, char value)
Headers
name
to value
. This will remove all previous values associated with name
.setChar
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setShort(CharSequence name, short value)
Headers
name
to value
. This will remove all previous values associated with name
.setShort
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setInt(CharSequence name, int value)
Headers
name
to value
. This will remove all previous values associated with name
.setInt
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setLong(CharSequence name, long value)
Headers
name
to value
. This will remove all previous values associated with name
.setLong
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setFloat(CharSequence name, float value)
Headers
name
to value
. This will remove all previous values associated with name
.setFloat
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setDouble(CharSequence name, double value)
Headers
name
to value
. This will remove all previous values associated with name
.setDouble
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers setTimeMillis(CharSequence name, long value)
Headers
name
to value
. This will remove all previous values associated with name
.setTimeMillis
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- The name to modifyvalue
- The valuethis
public Http2Headers set(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Headers
headers
.set
in interface Headers<CharSequence,CharSequence,Http2Headers>
this
public Http2Headers setAll(Headers<? extends CharSequence,? extends CharSequence,?> headers)
Headers
#set(K, V)
for each entry in headers
.setAll
in interface Headers<CharSequence,CharSequence,Http2Headers>
headers
- The headers used to #set(K, V)
values in this instancethis
public boolean remove(CharSequence name)
Headers
name
.remove
in interface Headers<CharSequence,CharSequence,Http2Headers>
name
- the header nametrue
if at least one entry has been removed.public Http2Headers clear()
Headers
Headers.size()
equals 0
.clear
in interface Headers<CharSequence,CharSequence,Http2Headers>
this
public Iterator<Map.Entry<CharSequence,CharSequence>> iterator()
Http2Headers
iterator
in interface Headers<CharSequence,CharSequence,Http2Headers>
iterator
in interface Http2Headers
iterator
in interface Iterable<Map.Entry<CharSequence,CharSequence>>
public Http2Headers method(CharSequence value)
Http2Headers
Http2Headers.PseudoHeaderName.METHOD
header or null
if there is no such headermethod
in interface Http2Headers
public Http2Headers scheme(CharSequence value)
Http2Headers
Http2Headers.PseudoHeaderName.SCHEME
header if there is no such headerscheme
in interface Http2Headers
public Http2Headers authority(CharSequence value)
Http2Headers
Http2Headers.PseudoHeaderName.AUTHORITY
header or null
if there is no such headerauthority
in interface Http2Headers
public Http2Headers path(CharSequence value)
Http2Headers
Http2Headers.PseudoHeaderName.PATH
header or null
if there is no such headerpath
in interface Http2Headers
public Http2Headers status(CharSequence value)
Http2Headers
Http2Headers.PseudoHeaderName.STATUS
header or null
if there is no such headerstatus
in interface Http2Headers
public CharSequence method()
Http2Headers
Http2Headers.PseudoHeaderName.METHOD
header or null
if there is no such headermethod
in interface Http2Headers
public CharSequence scheme()
Http2Headers
Http2Headers.PseudoHeaderName.SCHEME
header or null
if there is no such headerscheme
in interface Http2Headers
public CharSequence authority()
Http2Headers
Http2Headers.PseudoHeaderName.AUTHORITY
header or null
if there is no such headerauthority
in interface Http2Headers
public CharSequence path()
Http2Headers
Http2Headers.PseudoHeaderName.PATH
header or null
if there is no such headerpath
in interface Http2Headers
public CharSequence status()
Http2Headers
Http2Headers.PseudoHeaderName.STATUS
header or null
if there is no such headerstatus
in interface Http2Headers
Copyright © 2008–2017 The Netty Project. All rights reserved.