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, setTransferEncodingChunkedpublic DefaultHttpHeaders()
public DefaultHttpHeaders(boolean validate)
public HttpHeaders add(String name, Object value)
HttpHeadersString, 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 HttpHeadersname - The name of the header being addedvalue - The value of the header being addedthispublic HttpHeaders add(String name, Iterable<?> values)
HttpHeaders
for (Object v: values) {
if (v == null) {
break;
}
headers.add(name, v);
}
add in class HttpHeadersname - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders remove(String name)
HttpHeadersremove in class HttpHeadersname - The name of the header to removethispublic HttpHeaders set(String name, Object value)
HttpHeadersString, 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 HttpHeadersname - The name of the header being setvalue - The value of the header being setthispublic 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 HttpHeadersname - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders clear()
HttpHeadersHttpMessage.clear in class HttpHeadersthispublic String get(String name)
HttpHeadersget in class HttpHeadersname - The name of the header to searchnull if there is no such headerpublic List<String> getAll(String name)
HttpHeadersgetAll in class HttpHeadersname - 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()
HttpHeadersList 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 HttpHeaderspublic boolean contains(String name)
HttpHeaderscontains in class HttpHeadersname - The name of the header to search forpublic boolean isEmpty()
HttpHeadersisEmpty in class HttpHeaderspublic boolean contains(String name, String value, boolean ignoreCaseValue)
HttpHeaderstrue if a header with the name and value exists.contains in class HttpHeadersname - the headernamevalue - the valueignoreCaseValue - true if case should be ignoredtrue if it contains it false otherwisepublic Set<String> names()
HttpHeadersSet 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 HttpHeadersCopyright © 2008-2016 The Netty Project. All Rights Reserved.