Package io.netty.handler.codec.http
Class CombinedHttpHeaders.CombinedHttpHeadersImpl
java.lang.Object
io.netty.handler.codec.DefaultHeaders<CharSequence,CharSequence,CombinedHttpHeaders.CombinedHttpHeadersImpl>
io.netty.handler.codec.http.CombinedHttpHeaders.CombinedHttpHeadersImpl
- All Implemented Interfaces:
Headers<CharSequence,
,CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> Iterable<Map.Entry<CharSequence,
CharSequence>>
- Enclosing class:
CombinedHttpHeaders
private static final class CombinedHttpHeaders.CombinedHttpHeadersImpl
extends DefaultHeaders<CharSequence,CharSequence,CombinedHttpHeaders.CombinedHttpHeadersImpl>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interface
Escapes comma separated values (CSV).Nested classes/interfaces inherited from class io.netty.handler.codec.DefaultHeaders
DefaultHeaders.HeaderEntry<K,
V>, DefaultHeaders.NameValidator<K>, DefaultHeaders.ValueValidator<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
An estimate of the size of a header value.Fields inherited from class io.netty.handler.codec.DefaultHeaders
head
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedHttpHeadersImpl
(HashingStrategy<CharSequence> nameHashingStrategy, ValueConverter<CharSequence> valueConverter, DefaultHeaders.NameValidator<CharSequence> nameValidator, DefaultHeaders.ValueValidator<CharSequence> valueValidator) CombinedHttpHeadersImpl
(HashingStrategy<CharSequence> nameHashingStrategy, ValueConverter<CharSequence> valueConverter, DefaultHeaders.NameValidator<CharSequence> nameValidator, DefaultHeaders.ValueValidator<CharSequence> valueValidator, int sizeHint) -
Method Summary
Modifier and TypeMethodDescriptionadd
(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Adds all header names and values ofheaders
to this object.add
(CharSequence name, CharSequence value) Adds a new header with the specifiedname
andvalue
.add
(CharSequence name, CharSequence... values) Adds new headers with the specifiedname
andvalues
.add
(CharSequence name, Iterable<? extends CharSequence> values) Adds new headers with the specifiedname
andvalues
.addEscapedValue
(CharSequence name, CharSequence escapedValue) 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.private static boolean
cannotBeCombined
(CharSequence name) private static <T> CharSequence
commaSeparate
(CharSequence name, CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<T> escaper, Iterable<? extends T> values) private static <T> CharSequence
commaSeparate
(CharSequence name, CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<T> escaper, T... values) private static CharSequence
commaSeparateEscapedValues
(CharSequence currentValue, CharSequence value) getAll
(CharSequence name) Returns all values for the header with the specified name.set
(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Clears the current header entries and copies all header entries of the specifiedheaders
.set
(CharSequence name, CharSequence... values) Sets a header with the specified name and values.set
(CharSequence name, Iterable<? extends CharSequence> values) Sets a new 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
.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.valueIterator
(CharSequence name) Equivalent toDefaultHeaders.getAll(Object)
but no intermediate list is generated.Methods inherited from class io.netty.handler.codec.DefaultHeaders
addBoolean, addByte, addChar, addDouble, addFloat, addImpl, addInt, addLong, addShort, addTimeMillis, clear, contains, contains, contains, containsBoolean, containsByte, containsChar, containsDouble, containsFloat, containsInt, containsLong, containsObject, containsShort, containsTimeMillis, copy, equals, equals, get, get, 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, hashCode, isEmpty, iterator, names, nameValidator, newHeaderEntry, remove, set, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setTimeMillis, size, toString, validateName, validateValue, valueConverter, valueValidator
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
VALUE_LENGTH_ESTIMATE
private static final int VALUE_LENGTH_ESTIMATEAn estimate of the size of a header value.- See Also:
-
objectEscaper
-
charSequenceEscaper
private CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<CharSequence> charSequenceEscaper
-
-
Constructor Details
-
CombinedHttpHeadersImpl
CombinedHttpHeadersImpl(HashingStrategy<CharSequence> nameHashingStrategy, ValueConverter<CharSequence> valueConverter, DefaultHeaders.NameValidator<CharSequence> nameValidator, DefaultHeaders.ValueValidator<CharSequence> valueValidator) -
CombinedHttpHeadersImpl
CombinedHttpHeadersImpl(HashingStrategy<CharSequence> nameHashingStrategy, ValueConverter<CharSequence> valueConverter, DefaultHeaders.NameValidator<CharSequence> nameValidator, DefaultHeaders.ValueValidator<CharSequence> valueValidator, int sizeHint)
-
-
Method Details
-
objectEscaper
-
charSequenceEscaper
private CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<CharSequence> charSequenceEscaper() -
valueIterator
Description copied from class:DefaultHeaders
Equivalent toDefaultHeaders.getAll(Object)
but no intermediate list is generated.- Overrides:
valueIterator
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the name of the header to retrieve- Returns:
- an
Iterator
of header values corresponding toname
.
-
getAll
Description copied from interface:Headers
Returns all values for the header with the specified name. The returnedList
can't be modified.- Specified by:
getAll
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
getAll
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the name of the header to retrieve- Returns:
- a
List
of header values or an emptyList
if no values are found.
-
add
public CombinedHttpHeaders.CombinedHttpHeadersImpl add(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Description copied from interface:Headers
Adds all header names and values ofheaders
to this object.- Specified by:
add
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
add
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Returns:
this
-
set
public CombinedHttpHeaders.CombinedHttpHeadersImpl set(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Description copied from interface:Headers
Clears the current header entries and copies all header entries of the specifiedheaders
.- Specified by:
set
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
set
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Returns:
this
-
setAll
public CombinedHttpHeaders.CombinedHttpHeadersImpl setAll(Headers<? extends CharSequence, ? extends CharSequence, ?> headers) Description copied from interface:Headers
Retains all current headers but callsHeaders.set(K, V)
for each entry inheaders
.- Specified by:
setAll
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
setAll
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
headers
- The headers used toHeaders.set(K, V)
values in this instance- Returns:
this
-
add
Description copied from interface:Headers
Adds a new header with the specifiedname
andvalue
.- Specified by:
add
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
add
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the name of the headervalue
- the value of the header- Returns:
this
-
add
Description copied from interface:Headers
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Specified by:
add
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
add
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
add
public CombinedHttpHeaders.CombinedHttpHeadersImpl add(CharSequence name, Iterable<? extends CharSequence> values) Description copied from interface:Headers
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Specified by:
add
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
add
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
addObject
Description copied from interface:Headers
Adds a new header. Before thevalue
is added, it's converted to typeT
.- Specified by:
addObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
addObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addObject
Description copied from interface:Headers
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Specified by:
addObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
addObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
addObject
Description copied from interface:Headers
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Specified by:
addObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
addObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
set
Description copied from interface:Headers
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); }
- Specified by:
set
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
set
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
set
public CombinedHttpHeaders.CombinedHttpHeadersImpl set(CharSequence name, Iterable<? extends CharSequence> values) Description copied from interface:Headers
Sets a new header with the specified name and values. This method is equivalent tofor (T v : values) { headers.addObject(name, v); }
- Specified by:
set
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
set
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
setObject
Description copied from interface:Headers
Sets a new header. Any existing headers with this name are removed. Before thevalue
is add, it's converted to typeT
.- Specified by:
setObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
setObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
setObject
Description copied from interface:Headers
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); }
- Specified by:
setObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
setObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
setObject
Description copied from interface:Headers
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); }
- Specified by:
setObject
in interfaceHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Overrides:
setObject
in classDefaultHeaders<CharSequence,
CharSequence, CombinedHttpHeaders.CombinedHttpHeadersImpl> - Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
cannotBeCombined
-
addEscapedValue
private CombinedHttpHeaders.CombinedHttpHeadersImpl addEscapedValue(CharSequence name, CharSequence escapedValue) -
commaSeparate
private static <T> CharSequence commaSeparate(CharSequence name, CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<T> escaper, T... values) -
commaSeparate
private static <T> CharSequence commaSeparate(CharSequence name, CombinedHttpHeaders.CombinedHttpHeadersImpl.CsvValueEscaper<T> escaper, Iterable<? extends T> values) -
commaSeparateEscapedValues
private static CharSequence commaSeparateEscapedValues(CharSequence currentValue, CharSequence value)
-