Class DefaultHttp2Headers
java.lang.Object
io.netty.handler.codec.DefaultHeaders<CharSequence, CharSequence, Http2Headers>
io.netty.handler.codec.http2.DefaultHttp2Headers
- All Implemented Interfaces:
Headers<CharSequence, CharSequence, Http2Headers>, Http2Headers, Iterable<Map.Entry<CharSequence, CharSequence>>
public class DefaultHttp2Headers
extends DefaultHeaders<CharSequence, CharSequence, Http2Headers>
implements Http2Headers
-
Nested Class Summary
Nested classes/interfaces inherited from class DefaultHeaders
DefaultHeaders.HeaderEntry<K,V>, DefaultHeaders.NameValidator<K>, DefaultHeaders.ValueValidator<V> Modifier and TypeClassDescriptionprotected static classstatic interfacestatic interfaceNested classes/interfaces inherited from interface Http2Headers
Http2Headers.PseudoHeaderNameModifier and TypeInterfaceDescriptionstatic enumHTTP/2 pseudo-headers names. -
Field Summary
Fields inherited from class DefaultHeaders
headModifier and TypeFieldDescriptionprotected final DefaultHeaders.HeaderEntry<CharSequence, CharSequence> -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance.DefaultHttp2Headers(boolean validate) Create a new instance.DefaultHttp2Headers(boolean validateNames, boolean validateValues, int arraySizeHint) Create a new instance.DefaultHttp2Headers(boolean validate, int arraySizeHint) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets theHttp2Headers.PseudoHeaderName.AUTHORITYheader ornullif there is no such headerauthority(CharSequence value) Sets theHttp2Headers.PseudoHeaderName.AUTHORITYheaderclear()Removes all headers.booleancontains(CharSequence name, CharSequence value) Returnstrueif a header with thenameandvalueexists,falseotherwise.booleancontains(CharSequence name, CharSequence value, boolean caseInsensitive) Returnstrueif a header with thenameandvalueexists,falseotherwise.booleaninthashCode()method()Gets theHttp2Headers.PseudoHeaderName.METHODheader ornullif there is no such headermethod(CharSequence value) Sets theHttp2Headers.PseudoHeaderName.METHODheaderprotected final DefaultHeaders.HeaderEntry<CharSequence, CharSequence> newHeaderEntry(int h, CharSequence name, CharSequence value, DefaultHeaders.HeaderEntry<CharSequence, CharSequence> next) path()Gets theHttp2Headers.PseudoHeaderName.PATHheader ornullif there is no such headerpath(CharSequence value) Sets theHttp2Headers.PseudoHeaderName.PATHheaderscheme()Gets theHttp2Headers.PseudoHeaderName.SCHEMEheader ornullif there is no such headerscheme(CharSequence value) Sets theHttp2Headers.PseudoHeaderName.SCHEMEheaderstatus()Gets theHttp2Headers.PseudoHeaderName.STATUSheader ornullif there is no such headerstatus(CharSequence value) Sets theHttp2Headers.PseudoHeaderName.STATUSheaderprotected voidvalidateName(DefaultHeaders.NameValidator<CharSequence> validator, boolean forAdd, CharSequence name) Call out to the givenDefaultHeaders.NameValidatorto validate the given name.protected voidvalidateValue(DefaultHeaders.ValueValidator<CharSequence> validator, CharSequence name, CharSequence value) Methods inherited from class DefaultHeaders
add, add, add, add, addBoolean, addByte, addChar, addDouble, addFloat, addImpl, addInt, addLong, addObject, addObject, addObject, addShort, addTimeMillis, contains, contains, containsBoolean, containsByte, containsChar, containsDouble, containsFloat, containsInt, containsLong, containsObject, containsShort, containsTimeMillis, copy, equals, get, get, getAll, getAllAndRemove, getAndRemove, getAndRemove, getBoolean, getBoolean, getBooleanAndRemove, getBooleanAndRemove, getByte, getByte, getByteAndRemove, getByteAndRemove, getChar, getChar, getCharAndRemove, getCharAndRemove, getDouble, getDouble, getDoubleAndRemove, getDoubleAndRemove, getFloat, getFloat, getFloatAndRemove, getFloatAndRemove, getInt, getInt, getIntAndRemove, getIntAndRemove, getLong, getLong, getLongAndRemove, getLongAndRemove, getShort, getShort, getShortAndRemove, getShortAndRemove, getTimeMillis, getTimeMillis, getTimeMillisAndRemove, getTimeMillisAndRemove, hashCode, isEmpty, iterator, names, nameValidator, remove, set, set, set, set, setAll, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setObject, setObject, setObject, setShort, setTimeMillis, size, toString, valueConverter, valueIterator, valueValidatorModifier and TypeMethodDescriptionadd(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Adds all header names and values ofheadersto this object.add(CharSequence name, Iterable<? extends CharSequence> values) Adds new headers with the specifiednameandvalues.add(CharSequence name, CharSequence value) Adds a new header with the specifiednameandvalue.add(CharSequence name, CharSequence... values) Adds new headers with the specifiednameandvalues.addBoolean(CharSequence name, boolean value) Adds a new header.addByte(CharSequence name, byte value) Adds a new header.addChar(CharSequence name, char value) Adds a new header.addDouble(CharSequence name, double value) Adds a new header.addFloat(CharSequence name, float value) Adds a new header.protected voidaddImpl(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) addInt(CharSequence name, int value) Adds a new header.addLong(CharSequence name, long value) Adds a new header.addObject(CharSequence name, Iterable<?> values) Adds a new header with the specified name and values.addObject(CharSequence name, Object value) Adds a new header.addObject(CharSequence name, Object... values) Adds a new header with the specified name and values.addShort(CharSequence name, short value) Adds a new header.addTimeMillis(CharSequence name, long value) Adds a new header.booleancontains(CharSequence name) Returnstrueif a header with thenameexists,falseotherwise.final booleancontains(CharSequence name, CharSequence value, HashingStrategy<? super CharSequence> valueHashingStrategy) booleancontainsBoolean(CharSequence name, boolean value) Returnstrueif a header with the name and value exists.booleancontainsByte(CharSequence name, byte value) Returnstrueif a header with the name and value exists.booleancontainsChar(CharSequence name, char value) Returnstrueif a header with the name and value exists.booleancontainsDouble(CharSequence name, double value) Returnstrueif a header with the name and value exists.booleancontainsFloat(CharSequence name, float value) Returnstrueif a header with the name and value exists.booleancontainsInt(CharSequence name, int value) Returnstrueif a header with the name and value exists.booleancontainsLong(CharSequence name, long value) Returnstrueif a header with the name and value exists.booleancontainsObject(CharSequence name, Object value) Returnstrueif a header with the name and value exists.booleancontainsShort(CharSequence name, short value) Returnstrueif a header with the name and value exists.booleancontainsTimeMillis(CharSequence name, long value) Returnstrueif a header with the name and value exists.copy()Returns a deep copy of this instance.final booleanequals(Headers<CharSequence, CharSequence, ?> h2, HashingStrategy<CharSequence> valueHashingStrategy) Test this object for equality againsth2.get(CharSequence name) Returns the value of a header with the specified name.get(CharSequence name, CharSequence defaultValue) Returns the value of a header with the specified name.getAll(CharSequence name) Returns all values for the header with the specified name.getAllAndRemove(CharSequence name) Returns all values for the header with the specified name and removes them from this object.getAndRemove(CharSequence name) Returns the value of a header with the specified name and removes it from this object.getAndRemove(CharSequence name, CharSequence defaultValue) Returns the value of a header with the specified name and removes it from this object.getBoolean(CharSequence name) Returns thebooleanvalue of a header with the specified name.booleangetBoolean(CharSequence name, boolean defaultValue) Returns thebooleanvalue of a header with the specified name.Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.booleangetBooleanAndRemove(CharSequence name, boolean defaultValue) Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.getByte(CharSequence name) Returns thebytevalue of a header with the specified name.bytegetByte(CharSequence name, byte defaultValue) Returns thebytevalue of a header with the specified name.getByteAndRemove(CharSequence name) Returns thebytevalue of a header with the specifiednameand removes the header from this object.bytegetByteAndRemove(CharSequence name, byte defaultValue) Returns thebytevalue of a header with the specifiednameand removes the header from this object.getChar(CharSequence name) Returns thecharvalue of a header with the specified name.chargetChar(CharSequence name, char defaultValue) Returns thecharvalue of a header with the specified name.getCharAndRemove(CharSequence name) Returns thecharvalue of a header with the specifiednameand removes the header from this object.chargetCharAndRemove(CharSequence name, char defaultValue) Returns thecharvalue of a header with the specifiednameand removes the header from this object.getDouble(CharSequence name) Returns thedoublevalue of a header with the specified name.doublegetDouble(CharSequence name, double defaultValue) Returns thedoublevalue of a header with the specified name.Returns thedoublevalue of a header with the specifiednameand removes the header from this object.doublegetDoubleAndRemove(CharSequence name, double defaultValue) Returns thedoublevalue of a header with the specifiednameand removes the header from this object.getFloat(CharSequence name) Returns thefloatvalue of a header with the specified name.floatgetFloat(CharSequence name, float defaultValue) Returns thefloatvalue of a header with the specified name.Returns thefloatvalue of a header with the specifiednameand removes the header from this object.floatgetFloatAndRemove(CharSequence name, float defaultValue) Returns thefloatvalue of a header with the specifiednameand removes the header from this object.getInt(CharSequence name) Returns theintvalue of a header with the specified name.intgetInt(CharSequence name, int defaultValue) Returns theintvalue of a header with the specified name.getIntAndRemove(CharSequence name) Returns theintvalue of a header with the specifiednameand removes the header from this object.intgetIntAndRemove(CharSequence name, int defaultValue) Returns theintvalue of a header with the specifiednameand removes the header from this object.getLong(CharSequence name) Returns thelongvalue of a header with the specified name.longgetLong(CharSequence name, long defaultValue) Returns thelongvalue of a header with the specified name.getLongAndRemove(CharSequence name) Returns thelongvalue of a header with the specifiednameand removes the header from this object.longgetLongAndRemove(CharSequence name, long defaultValue) Returns thelongvalue of a header with the specifiednameand removes the header from this object.getShort(CharSequence name) Returns theshortvalue of a header with the specified name.shortgetShort(CharSequence name, short defaultValue) Returns theshortvalue of a header with the specified name.Returns theshortvalue of a header with the specifiednameand removes the header from this object.shortgetShortAndRemove(CharSequence name, short defaultValue) Returns theshortvalue of a header with the specifiednameand removes the header from this object.getTimeMillis(CharSequence name) Returns the value of a header with the specified name in milliseconds.longgetTimeMillis(CharSequence name, long defaultValue) Returns the value of a header with the specified name in milliseconds.Returns the value of a header with the specifiednamein milliseconds and removes the header from this object.longgetTimeMillisAndRemove(CharSequence name, long defaultValue) Returns the value of a header with the specifiednamein milliseconds and removes the header from this object.final inthashCode(HashingStrategy<CharSequence> valueHashingStrategy) Generate a hash code for this object given aHashingStrategyto generate hash codes for individual values.booleanisEmpty()iterator()names()Returns aSetof all header names in this object.protected DefaultHeaders.NameValidator<CharSequence> booleanremove(CharSequence name) Removes all headers with the specifiedname.set(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Clears the current header entries and copies all header entries of the specifiedheaders.set(CharSequence name, Iterable<? extends CharSequence> values) Sets a new header with the specified name and values.set(CharSequence name, CharSequence value) Sets a header with the specified name and value.set(CharSequence name, CharSequence... values) Sets a header with the specified name and values.setAll(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Retains all current headers but callsHeaders.set(K, V)for each entry inheaders.setBoolean(CharSequence name, boolean value) Set thenametovalue.setByte(CharSequence name, byte value) Set thenametovalue.setChar(CharSequence name, char value) Set thenametovalue.setDouble(CharSequence name, double value) Set thenametovalue.setFloat(CharSequence name, float value) Set thenametovalue.setInt(CharSequence name, int value) Set thenametovalue.setLong(CharSequence name, long value) Set thenametovalue.setObject(CharSequence name, Iterable<?> values) Sets a header with the specified name and values.setObject(CharSequence name, Object value) Sets a new header.setObject(CharSequence name, Object... values) Sets a header with the specified name and values.setShort(CharSequence name, short value) Set thenametovalue.setTimeMillis(CharSequence name, long value) Set thenametovalue.intsize()Returns the number of headers in this object.toString()protected ValueConverter<CharSequence> valueIterator(CharSequence name) Equivalent toDefaultHeaders.getAll(Object)but no intermediate list is generated.protected DefaultHeaders.ValueValidator<CharSequence> Methods inherited from interface Http2Headers
iterator, valueIteratorModifier and TypeMethodDescriptioniterator()Returns an iterator over all HTTP/2 headers.valueIterator(CharSequence name) Equivalent toHeaders.getAll(Object)but no intermediate list is generated.Methods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
DefaultHttp2Headers
public DefaultHttp2Headers()Create a new instance.Header names and values will be validated according to RFC 9113.
-
DefaultHttp2Headers
public DefaultHttp2Headers(boolean validate) Create a new instance.- Parameters:
validate-trueto validate header names and values according to RFC 9113.falseto not validate header names or values.
-
DefaultHttp2Headers
public DefaultHttp2Headers(boolean validate, int arraySizeHint) Create a new instance.- Parameters:
validate-trueto validate header names and values according to RFC 9113.falseto not validate header names or values.arraySizeHint- A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.- See Also:
-
DefaultHttp2Headers
public DefaultHttp2Headers(boolean validateNames, boolean validateValues, int arraySizeHint) Create a new instance.- Parameters:
validateNames-trueto validate header names according to RFC 9113.falseto not validate header names.validateValues-trueto validate header values according to RFC 9113. Otherwise,falseto not validate values.arraySizeHint- A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.
-
-
Method Details
-
validateName
protected void validateName(DefaultHeaders.NameValidator<CharSequence> validator, boolean forAdd, CharSequence name) Description copied from class:DefaultHeadersCall out to the givenDefaultHeaders.NameValidatorto validate the given name.- Overrides:
validateNamein classDefaultHeaders<CharSequence, CharSequence, Http2Headers>- Parameters:
validator- the validator to useforAdd-trueif this validation is for adding to the headers, orfalseif this is for setting (overwriting) the given header.name- the name to validate.
-
validateValue
protected void validateValue(DefaultHeaders.ValueValidator<CharSequence> validator, CharSequence name, CharSequence value) - Overrides:
validateValuein classDefaultHeaders<CharSequence, CharSequence, Http2Headers>
-
clear
Description copied from interface:HeadersRemoves all headers. After a call to this methodHeaders.size()equals0.- Specified by:
clearin interfaceHeaders<CharSequence, CharSequence, Http2Headers>- Overrides:
clearin classDefaultHeaders<CharSequence, CharSequence, Http2Headers>- Returns:
this
-
equals
- Overrides:
equalsin classDefaultHeaders<CharSequence, CharSequence, Http2Headers>
-
hashCode
public int hashCode()- Overrides:
hashCodein classDefaultHeaders<CharSequence, CharSequence, Http2Headers>
-
method
Description copied from interface:Http2HeadersSets theHttp2Headers.PseudoHeaderName.METHODheader- Specified by:
methodin interfaceHttp2Headers
-
scheme
Description copied from interface:Http2HeadersSets theHttp2Headers.PseudoHeaderName.SCHEMEheader- Specified by:
schemein interfaceHttp2Headers
-
authority
Description copied from interface:Http2HeadersSets theHttp2Headers.PseudoHeaderName.AUTHORITYheader- Specified by:
authorityin interfaceHttp2Headers
-
path
Description copied from interface:Http2HeadersSets theHttp2Headers.PseudoHeaderName.PATHheader- Specified by:
pathin interfaceHttp2Headers
-
status
Description copied from interface:Http2HeadersSets theHttp2Headers.PseudoHeaderName.STATUSheader- Specified by:
statusin interfaceHttp2Headers
-
method
Description copied from interface:Http2HeadersGets theHttp2Headers.PseudoHeaderName.METHODheader ornullif there is no such header- Specified by:
methodin interfaceHttp2Headers
-
scheme
Description copied from interface:Http2HeadersGets theHttp2Headers.PseudoHeaderName.SCHEMEheader ornullif there is no such header- Specified by:
schemein interfaceHttp2Headers
-
authority
Description copied from interface:Http2HeadersGets theHttp2Headers.PseudoHeaderName.AUTHORITYheader ornullif there is no such header- Specified by:
authorityin interfaceHttp2Headers
-
path
Description copied from interface:Http2HeadersGets theHttp2Headers.PseudoHeaderName.PATHheader ornullif there is no such header- Specified by:
pathin interfaceHttp2Headers
-
status
Description copied from interface:Http2HeadersGets theHttp2Headers.PseudoHeaderName.STATUSheader ornullif there is no such header- Specified by:
statusin interfaceHttp2Headers
-
contains
Description copied from interface:HeadersReturnstrueif a header with thenameandvalueexists,falseotherwise.The
Object.equals(Object)method is used to test for equality ofvalue.- Specified by:
containsin interfaceHeaders<CharSequence, CharSequence, Http2Headers>- Overrides:
containsin classDefaultHeaders<CharSequence, CharSequence, Http2Headers>- Parameters:
name- the header namevalue- the header value of the header to find
-
contains
Description copied from interface:Http2HeadersReturnstrueif a header with thenameandvalueexists,falseotherwise.If
caseInsensitiveistruethen a case insensitive compare is done on the value.- Specified by:
containsin interfaceHttp2Headers- Parameters:
name- the name of the header to findvalue- the value of the header to findcaseInsensitive-truethen a case insensitive compare is run to compare values. otherwise a case sensitive compare is run to compare values.
-
newHeaderEntry
protected final DefaultHeaders.HeaderEntry<CharSequence, CharSequence> newHeaderEntry(int h, CharSequence name, CharSequence value, DefaultHeaders.HeaderEntry<CharSequence, CharSequence> next) - Overrides:
newHeaderEntryin classDefaultHeaders<CharSequence, CharSequence, Http2Headers>
-