public class DefaultHttpHeaders extends HttpHeaders
HttpHeaders.Names, HttpHeaders.Values
限定符和类型 | 字段和说明 |
---|---|
protected boolean |
validate |
EMPTY_HEADERS
构造器和说明 |
---|
DefaultHttpHeaders() |
DefaultHttpHeaders(boolean validate) |
限定符和类型 | 方法和说明 |
---|---|
HttpHeaders |
add(java.lang.String name,
java.lang.Iterable<?> values)
Adds a new header with the specified name and values.
|
HttpHeaders |
add(java.lang.String name,
java.lang.Object value)
Adds a new header with the specified name and value.
|
HttpHeaders |
clear()
Removes all headers from this
HttpMessage . |
boolean |
contains(java.lang.String name)
Checks to see if there is a header with the specified name
|
boolean |
contains(java.lang.String name,
java.lang.String value,
boolean ignoreCaseValue)
Returns
true if a header with the name and value exists. |
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.String name)
Returns the value of a header with the specified name.
|
java.util.List<java.lang.String> |
getAll(java.lang.String name)
Returns the values of headers with the specified 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.String name)
Removes the header with the specified name.
|
HttpHeaders |
set(java.lang.String name,
java.lang.Iterable<?> values)
Sets a header with the specified name and values.
|
HttpHeaders |
set(java.lang.String name,
java.lang.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(java.lang.String 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
在类中 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)
HttpHeaders
for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
add
在类中 HttpHeaders
name
- The name of the headers being setvalues
- The values of the headers being setthis
public HttpHeaders remove(java.lang.String name)
HttpHeaders
remove
在类中 HttpHeaders
name
- The name of the header to removethis
public HttpHeaders set(java.lang.String 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
在类中 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)
HttpHeaders
headers.remove(name); for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
set
在类中 HttpHeaders
name
- The name of the headers being setvalues
- The values of the headers being setthis
public HttpHeaders clear()
HttpHeaders
HttpMessage
.clear
在类中 HttpHeaders
this
public java.lang.String get(java.lang.String name)
HttpHeaders
get
在类中 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)
HttpHeaders
getAll
在类中 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
在类中 HttpHeaders
public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iterator()
public boolean contains(java.lang.String name)
HttpHeaders
contains
在类中 HttpHeaders
name
- The name of the header to search forpublic boolean isEmpty()
HttpHeaders
isEmpty
在类中 HttpHeaders
public boolean contains(java.lang.String name, java.lang.String value, boolean ignoreCaseValue)
HttpHeaders
true
if a header with the name and value exists.contains
在类中 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
在类中 HttpHeaders