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(java.lang.CharSequence name,
java.lang.Iterable<?> values)
Adds a new header with the specified name and values.
|
HttpHeaders |
add(java.lang.CharSequence name,
java.lang.Object value)
Adds a new header with the specified name and value.
|
HttpHeaders |
add(HttpHeaders headers)
Adds all header entries of the specified
headers. |
HttpHeaders |
add(java.lang.String name,
java.lang.Iterable<?> values) |
HttpHeaders |
add(java.lang.String name,
java.lang.Object value) |
HttpHeaders |
clear()
Removes all headers from this
HttpMessage. |
boolean |
contains(java.lang.CharSequence name)
Checks to see if there is a header with the specified name
|
boolean |
contains(java.lang.CharSequence name,
java.lang.CharSequence value,
boolean ignoreCaseValue)
Returns
true if a header with the name and value exists. |
boolean |
contains(java.lang.String name) |
boolean |
contains(java.lang.String name,
java.lang.String value,
boolean ignoreCaseValue) |
java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entries()
Returns a new
List that contains all headers in this object. |
java.lang.String |
get(java.lang.CharSequence name)
Returns the value of a header with the specified name.
|
java.lang.String |
get(java.lang.String name) |
java.util.List<java.lang.String> |
getAll(java.lang.CharSequence name)
Returns the values of headers with the specified name
|
java.util.List<java.lang.String> |
getAll(java.lang.String name) |
boolean |
isEmpty()
Checks if no header exists.
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> |
iterator() |
java.util.Set<java.lang.String> |
names()
Returns a new
Set that contains the names of all headers in this object. |
HttpHeaders |
remove(java.lang.CharSequence name)
Removes the header with the specified name.
|
HttpHeaders |
remove(java.lang.String name) |
HttpHeaders |
set(java.lang.CharSequence name,
java.lang.Iterable<?> values)
Sets a header with the specified name and values.
|
HttpHeaders |
set(java.lang.CharSequence name,
java.lang.Object value)
Sets a header with the specified name and value.
|
HttpHeaders |
set(HttpHeaders headers)
Cleans the current header entries and copies all header entries of the specified
headers. |
HttpHeaders |
set(java.lang.String name,
java.lang.Iterable<?> values) |
HttpHeaders |
set(java.lang.String name,
java.lang.Object value) |
addDateHeader, addDateHeader, addHeader, addHeader, addIntHeader, addIntHeader, clearHeaders, containsValue, encodeAscii, equalsIgnoreCase, getContentLength, getContentLength, getDate, getDate, getDateHeader, getDateHeader, getDateHeader, getDateHeader, getHeader, getHeader, getHeader, getHeader, getHost, getHost, getIntHeader, getIntHeader, getIntHeader, getIntHeader, is100ContinueExpected, isContentLengthSet, isKeepAlive, isTransferEncodingChunked, newEntity, newNameEntity, newValueEntity, removeHeader, removeHeader, removeTransferEncodingChunked, set100ContinueExpected, set100ContinueExpected, setContentLength, setDate, setDateHeader, setDateHeader, setDateHeader, setDateHeader, setHeader, setHeader, setHeader, setHeader, setHost, setHost, setIntHeader, setIntHeader, setIntHeader, setIntHeader, setKeepAlive, setTransferEncodingChunkedpublic DefaultHttpHeaders()
public DefaultHttpHeaders(boolean validate)
public HttpHeaders add(HttpHeaders headers)
HttpHeadersheaders.add in class HttpHeadersthispublic HttpHeaders set(HttpHeaders headers)
HttpHeadersheaders.set in class HttpHeadersthispublic HttpHeaders add(java.lang.String name, java.lang.Object value)
add in class HttpHeaders#add(CharSequence, Object)}public HttpHeaders add(java.lang.CharSequence name, java.lang.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(java.lang.String name, java.lang.Iterable<?> values)
add in class HttpHeaders#add(CharSequence, Iterable)}public HttpHeaders add(java.lang.CharSequence name, java.lang.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(java.lang.String name)
remove in class HttpHeaders#remove(CharSequence)}public HttpHeaders remove(java.lang.CharSequence name)
HttpHeadersremove in class HttpHeadersname - The name of the header to removethispublic HttpHeaders set(java.lang.String name, java.lang.Object value)
set in class HttpHeaders#set(CharSequence, Object)}public HttpHeaders set(java.lang.CharSequence name, java.lang.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(java.lang.String name, java.lang.Iterable<?> values)
set in class HttpHeaders#set(CharSequence, Iterable)}public HttpHeaders set(java.lang.CharSequence name, java.lang.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 java.lang.String get(java.lang.String name)
get in class HttpHeaders#get(CharSequence)}public java.lang.String get(java.lang.CharSequence name)
HttpHeadersget in class HttpHeadersname - The name of the header to searchnull if there is no such headerpublic java.util.List<java.lang.String> getAll(java.lang.String name)
getAll in class HttpHeaders#getAll(CharSequence)}public java.util.List<java.lang.String> getAll(java.lang.CharSequence name)
HttpHeadersgetAll in class HttpHeadersname - The name of the headers to searchList of header values which will be empty if no values
are foundpublic java.util.List<java.util.Map.Entry<java.lang.String,java.lang.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 java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iterator()
public boolean contains(java.lang.String name)
contains in class HttpHeadersHttpHeaders.contains(CharSequence)public boolean contains(java.lang.CharSequence name)
HttpHeaderscontains in class HttpHeadersname - The name of the header to search forpublic boolean isEmpty()
HttpHeadersisEmpty in class HttpHeaderspublic boolean contains(java.lang.String name,
java.lang.String value,
boolean ignoreCaseValue)
contains in class HttpHeaders#contains(CharSequence, CharSequence, boolean)}public boolean contains(java.lang.CharSequence name,
java.lang.CharSequence 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 java.util.Set<java.lang.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–2018 The Netty Project. All rights reserved.