public class DefaultHttpHeaders extends HttpHeaders
HttpHeaders.Names, HttpHeaders.Values| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
validate |
EMPTY_HEADERS| 构造器和说明 |
|---|
DefaultHttpHeaders() |
DefaultHttpHeaders(boolean validate) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在类中 HttpHeadersthispublic HttpHeaders set(HttpHeaders headers)
HttpHeadersheaders.set 在类中 HttpHeadersthispublic HttpHeaders add(java.lang.String name, java.lang.Object value)
add 在类中 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 在类中 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 在类中 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 在类中 HttpHeadersname - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders remove(java.lang.String name)
remove 在类中 HttpHeaders#remove(CharSequence)}public HttpHeaders remove(java.lang.CharSequence name)
HttpHeadersremove 在类中 HttpHeadersname - The name of the header to removethispublic HttpHeaders set(java.lang.String name, java.lang.Object value)
set 在类中 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 在类中 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 在类中 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 在类中 HttpHeadersname - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders clear()
HttpHeadersHttpMessage.clear 在类中 HttpHeadersthispublic java.lang.String get(java.lang.String name)
get 在类中 HttpHeaders#get(CharSequence)}public java.lang.String get(java.lang.CharSequence name)
HttpHeadersget 在类中 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 在类中 HttpHeaders#getAll(CharSequence)}public java.util.List<java.lang.String> getAll(java.lang.CharSequence name)
HttpHeadersgetAll 在类中 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 在类中 HttpHeaderspublic java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iterator()
public boolean contains(java.lang.String name)
contains 在类中 HttpHeadersHttpHeaders.contains(CharSequence)public boolean contains(java.lang.CharSequence name)
HttpHeaderscontains 在类中 HttpHeadersname - The name of the header to search forpublic boolean isEmpty()
HttpHeadersisEmpty 在类中 HttpHeaderspublic boolean contains(java.lang.String name,
java.lang.String value,
boolean ignoreCaseValue)
contains 在类中 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 在类中 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 在类中 HttpHeaders