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, setTransferEncodingChunked
public DefaultHttpHeaders()
public DefaultHttpHeaders(boolean validate)
public HttpHeaders add(HttpHeaders headers)
HttpHeaders
headers
.add
in class HttpHeaders
this
public HttpHeaders set(HttpHeaders headers)
HttpHeaders
headers
.set
in class HttpHeaders
this
public 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)
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(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 HttpHeaders
name
- The name of the headers being setvalues
- The values of the headers being setthis
public HttpHeaders remove(java.lang.String name)
remove
in class HttpHeaders
#remove(CharSequence)}
public HttpHeaders remove(java.lang.CharSequence name)
HttpHeaders
remove
in class HttpHeaders
name
- The name of the header to removethis
public 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)
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(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 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 java.lang.String get(java.lang.String name)
get
in class HttpHeaders
#get(CharSequence)}
public java.lang.String get(java.lang.CharSequence name)
HttpHeaders
get
in class HttpHeaders
name
- 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)
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 java.util.List<java.util.Map.Entry<java.lang.String,java.lang.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 java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iterator()
public boolean contains(java.lang.String name)
contains
in class HttpHeaders
HttpHeaders.contains(CharSequence)
public boolean contains(java.lang.CharSequence 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(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)
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 java.util.Set<java.lang.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–2018 The Netty Project. All rights reserved.