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 a new
List that contains all headers in this object. |
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()
Returns a new
Set that contains the names of all headers in this object. |
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
List
that contains all headers in this object. Note that modifying the
returned List
will not affect the state of this object. If you intend to enumerate over the header
entries only, use Iterable.iterator()
instead, which has much less overhead.entries
in class HttpHeaders
public 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
that contains the names of all headers in this object. Note that modifying the
returned Set
will not affect the state of this object. If you intend to enumerate over the header
entries only, use Iterable.iterator()
instead, which has much less overhead.names
in class HttpHeaders
Copyright © 2008-2016 The Netty Project. All Rights Reserved.