public class DefaultHttpHeaders extends HttpHeaders
HttpHeaders.Names, HttpHeaders.Values
Modifier and Type | Field and Description |
---|---|
protected boolean |
validate |
EMPTY_HEADERS
Constructor and Description |
---|
DefaultHttpHeaders() |
DefaultHttpHeaders(boolean validate) |
Modifier and Type | Method and Description |
---|---|
HttpHeaders |
add(String name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
HttpHeaders |
add(String name,
Object value)
Adds a new header with the specified name and value.
|
HttpHeaders |
clear()
Removes all headers from this
HttpMessage . |
boolean |
contains(String name)
Checks to see if there is a header with the specified name
|
boolean |
contains(String name,
String value,
boolean ignoreCaseValue)
Returns
true if a header with the name and value exists. |
List<Map.Entry<String,String>> |
entries()
Returns the all headers that this message contains.
|
String |
get(String name)
Returns the value of a header with the specified name.
|
List<String> |
getAll(String name)
Returns the values of headers with the specified name
|
boolean |
isEmpty()
Checks if no header exists.
|
Iterator<Map.Entry<String,String>> |
iterator() |
Set<String> |
names()
Gets a
Set of all header names that this message contains |
HttpHeaders |
remove(String name)
Removes the header with the specified name.
|
HttpHeaders |
set(String name,
Iterable<?> values)
Sets a header with the specified name and values.
|
HttpHeaders |
set(String name,
Object value)
Sets a header with the specified name and value.
|
add, addDateHeader, addHeader, addIntHeader, clearHeaders, getContentLength, getContentLength, getDate, getDate, getDateHeader, getDateHeader, getHeader, getHeader, getHost, getHost, getIntHeader, getIntHeader, is100ContinueExpected, isContentLengthSet, isKeepAlive, isTransferEncodingChunked, removeHeader, removeTransferEncodingChunked, set, set100ContinueExpected, set100ContinueExpected, setContentLength, setDate, setDateHeader, setDateHeader, setHeader, setHeader, setHost, setIntHeader, setIntHeader, setKeepAlive, setTransferEncodingChunked
public DefaultHttpHeaders()
public DefaultHttpHeaders(boolean validate)
public HttpHeaders add(String name, Object value)
HttpHeaders
String
, it is converted
into a String
by Object.toString()
, except in the cases
of Date
and Calendar
, which are formatted to the date
format defined in RFC2616.add
in class HttpHeaders
name
- The name of the header being addedvalue
- The value of the header being addedthis
public HttpHeaders add(String name, Iterable<?> values)
HttpHeaders
for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
add
in class HttpHeaders
name
- The name of the headers being setvalues
- The values of the headers being setthis
public HttpHeaders remove(String name)
HttpHeaders
remove
in class HttpHeaders
name
- The name of the header to removethis
public HttpHeaders set(String name, Object value)
HttpHeaders
String
, it is converted into a
String
by Object.toString()
, except for Date
and Calendar
, which are formatted to the date format defined in
RFC2616.set
in class HttpHeaders
name
- The name of the header being setvalue
- The value of the header being setthis
public HttpHeaders set(String name, Iterable<?> values)
HttpHeaders
headers.remove(name); for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
set
in class HttpHeaders
name
- The name of the headers being setvalues
- The values of the headers being setthis
public HttpHeaders clear()
HttpHeaders
HttpMessage
.clear
in class HttpHeaders
this
public String get(String name)
HttpHeaders
get
in class HttpHeaders
name
- The name of the header to searchnull
if there is no such headerpublic List<String> getAll(String name)
HttpHeaders
getAll
in class HttpHeaders
name
- The name of the headers to searchList
of header values which will be empty if no values
are foundpublic List<Map.Entry<String,String>> entries()
HttpHeaders
entries
in class HttpHeaders
List
of the header name-value entries, which will be
empty if no pairs are foundpublic boolean contains(String name)
HttpHeaders
contains
in class HttpHeaders
name
- The name of the header to search forpublic boolean isEmpty()
HttpHeaders
isEmpty
in class HttpHeaders
public boolean contains(String name, String value, boolean ignoreCaseValue)
HttpHeaders
true
if a header with the name and value exists.contains
in class HttpHeaders
name
- the headernamevalue
- the valueignoreCaseValue
- true
if case should be ignoredtrue
if it contains it false
otherwisepublic Set<String> names()
HttpHeaders
Set
of all header names that this message containsnames
in class HttpHeaders
Set
of all header namesCopyright © 2008-2014 The Netty Project. All Rights Reserved.