Top Description Inners Fields Constructors Methods
io.netty.handler.codec.http

public Class DefaultHttpHeaders

extends HttpHeaders
Class Inheritance
Known Direct Subclasses
io.netty.handler.codec.http.CombinedHttpHeaders
Imports
io.netty.handler.codec.CharSequenceValueConverter, .DateFormatter, .DefaultHeaders, .DefaultHeaders.NameValidator, .DefaultHeaders.ValueValidator, .DefaultHeadersImpl, .HeadersUtils, .ValueConverter, java.util.ArrayList, .Calendar, .Collections, .Date, .Iterator, .List, .Map, .Map.Entry, .Set

Default implementation of HttpHeaders.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final DefaultHeaders<CharSequence, CharSequence, ?>
Inherited from io.netty.handler.codec.http.HttpHeaders:
EMPTY_HEADERS

Constructor Summary

AccessConstructor and Description
public
DefaultHttpHeaders()

Create a new, empty HTTP headers object.

public
DefaultHttpHeaders(boolean
Should Netty validate header values to ensure they aren't malicious.
validate
)

Deprecated Prefer using the DefaultHttpHeaders() constructor instead, to always have validation enabled.

Warning

Setting validate to false will mean that Netty won't validate & protect against user-supplied header values that are malicious.

protected
DefaultHttpHeaders(boolean
Should Netty validate header values to ensure they aren't malicious.
validateValues
,
DefaultHeaders.NameValidator<CharSequence>
The NameValidator to use, never {@code null.
nameValidator
)

Create an HTTP headers object with the given name validator.

protected
DefaultHttpHeaders(DefaultHeaders.NameValidator<CharSequence>
The NameValidator to use, never null.
nameValidator
,
DefaultHeaders.ValueValidator<CharSequence>
The ValueValidator to use, never null.
valueValidator
)

Create an HTTP headers object with the given name and value validators.

protected
DefaultHttpHeaders(DefaultHeaders.NameValidator<CharSequence>
The NameValidator to use, never null.
nameValidator
,
DefaultHeaders.ValueValidator<CharSequence>
The ValueValidator to use, never null.
valueValidator
,
int
A hint about the anticipated number of entries.
sizeHint
)

Create an HTTP headers object with the given name and value validators.

protected

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders
add(HttpHeaders headers)

Overrides io.netty.handler.codec.http.HttpHeaders.add.

Adds all header entries of the specified headers.
public HttpHeaders
public HttpHeaders
add(CharSequence
The name of the header being added
name
,
Object
The value of the header being added
value
)

Overrides io.netty.handler.codec.http.HttpHeaders.add.

Adds a new header with the specified name and value.
public HttpHeaders
add(String name, Iterable<?> values)

Implements abstract io.netty.handler.codec.http.HttpHeaders.add.

public HttpHeaders
add(CharSequence
The name of the headers being set
name
,
Iterable<?>
The values of the headers being set
values
)

Overrides io.netty.handler.codec.http.HttpHeaders.add.

Adds a new header with the specified name and values.
public HttpHeaders
addInt(CharSequence
The name to modify
name
,
int
The value
value
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.addInt.

Add the name to value.
public HttpHeaders
addShort(CharSequence
The name to modify
name
,
short
The value
value
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.addShort.

Add the name to value.
public HttpHeaders
clear()

Implements abstract io.netty.handler.codec.http.HttpHeaders.clear.

Removes all headers from this HttpMessage.
public boolean
public boolean
contains(CharSequence
The name of the header to search for
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.contains.

Checks to see if there is a header with the specified name
public boolean
contains(String name, String value, boolean ignoreCase)

Overrides io.netty.handler.codec.http.HttpHeaders.contains.

public boolean
contains(CharSequence
the name of the header to find
name
,
CharSequence
the value of the header to find
value
,
boolean
true then a case insensitive compare is run to compare values. otherwise a case sensitive compare is run to compare values.
ignoreCase
)

Overrides io.netty.handler.codec.http.HttpHeaders.contains.

Returns true if a header with the name and value exists, false otherwise.
public HttpHeaders
copy()

Overrides io.netty.handler.codec.http.HttpHeaders.copy.

Returns a deep copy of the passed in HttpHeaders.
public List<Map.Entry<String, String>>
entries()

Implements abstract io.netty.handler.codec.http.HttpHeaders.entries.

Returns a new List that contains all headers in this object.
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public String
public String
get(CharSequence
The name of the header to search
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.get.

Returns the value of a header with the specified name.
public List<String>
public List<String>
getAll(CharSequence
The name of the headers to search
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.getAll.

Returns the values of headers with the specified name
public Integer
getInt(CharSequence
the name of the header to search
name
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getInt.

Returns the integer value of a header with the specified name.
public int
getInt(CharSequence
the name of the header to search
name
,
int
the default value
defaultValue
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getInt.

Returns the integer value of a header with the specified name.
public Short
getShort(CharSequence
the name of the header to search
name
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getShort.

Returns the short value of a header with the specified name.
public short
getShort(CharSequence
the name of the header to search
name
,
short
the default value
defaultValue
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getShort.

Returns the short value of a header with the specified name.
public Long
getTimeMillis(CharSequence
the name of the header to search
name
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getTimeMillis.

Returns the date value of a header with the specified name.
public long
getTimeMillis(CharSequence
the name of the header to search
name
,
long
the default value
defaultValue
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.getTimeMillis.

Returns the date value of a header with the specified name.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean
isEmpty()

Implements abstract io.netty.handler.codec.http.HttpHeaders.isEmpty.

Checks if no header exists.
public Iterator<Map.Entry<String, String>>
iterator()

Implements abstract io.netty.handler.codec.http.HttpHeaders.iterator.

Implements java.lang.Iterable.iterator.

Deprecated
Returns an iterator over elements of type T.
public Iterator<Map.Entry<CharSequence, CharSequence>>
public Set<String>
names()

Implements abstract io.netty.handler.codec.http.HttpHeaders.names.

Returns a new Set that contains the names of all headers in this object.
pack-priv static DefaultHeaders.NameValidator<CharSequence>
nameValidator(boolean validate)

public HttpHeaders
public HttpHeaders
remove(CharSequence
The name of the header to remove
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.remove.

Removes the header with the specified name.
public HttpHeaders
set(HttpHeaders headers)

Overrides io.netty.handler.codec.http.HttpHeaders.set.

Cleans the current header entries and copies all header entries of the specified headers.
public HttpHeaders
public HttpHeaders
set(CharSequence
The name of the header being set
name
,
Object
The value of the header being set
value
)

Overrides io.netty.handler.codec.http.HttpHeaders.set.

Sets a header with the specified name and value.
public HttpHeaders
set(String name, Iterable<?> values)

Implements abstract io.netty.handler.codec.http.HttpHeaders.set.

public HttpHeaders
set(CharSequence
The name of the headers being set
name
,
Iterable<?>
The values of the headers being set
values
)

Overrides io.netty.handler.codec.http.HttpHeaders.set.

Sets a header with the specified name and values.
public HttpHeaders
setInt(CharSequence
The name to modify
name
,
int
The value
value
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.setInt.

Set the name to value.
public HttpHeaders
setShort(CharSequence
The name to modify
name
,
short
The value
value
)

Implements abstract io.netty.handler.codec.http.HttpHeaders.setShort.

Set the name to value.
public int
size()

Implements abstract io.netty.handler.codec.http.HttpHeaders.size.

Returns the number of headers in this object.
public Iterator<CharSequence>
valueCharSequenceIterator(CharSequence
the name of the header to retrieve
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.valueCharSequenceIterator.

Equivalent to getAll(String) but it is possible that no intermediate list is generated.
pack-priv static ValueConverter<CharSequence>
public Iterator<String>
valueStringIterator(CharSequence
the name of the header to retrieve
name
)

Overrides io.netty.handler.codec.http.HttpHeaders.valueStringIterator.

Equivalent to getAll(String) but it is possible that no intermediate list is generated.
pack-priv static DefaultHeaders.ValueValidator<CharSequence>
valueValidator(boolean validate)

Inherited from io.netty.handler.codec.http.HttpHeaders:
addDateHeaderaddDateHeaderaddHeaderaddHeaderaddIntHeaderaddIntHeaderclearHeaderscontainsValueencodeAsciiequalsIgnoreCasegetgetAllAsStringgetAsStringgetContentLengthgetContentLengthgetDategetDategetDateHeadergetDateHeadergetDateHeadergetDateHeadergetHeadergetHeadergetHeadergetHeadergetHostgetHostgetIntHeadergetIntHeadergetIntHeadergetIntHeaderis100ContinueExpectedisContentLengthSetisKeepAliveisTransferEncodingChunkediteratorAsStringnewEntityremoveHeaderremoveHeaderremoveTransferEncodingChunkedset100ContinueExpectedset100ContinueExpectedsetAllsetContentLengthsetDatesetDateHeadersetDateHeadersetDateHeadersetDateHeadersetHeadersetHeadersetHeadersetHeadersetHostsetHostsetIntHeadersetIntHeadersetIntHeadersetIntHeadersetKeepAlivesetTransferEncodingChunkedtoString