public abstract class HttpHeaders extends Object implements Iterable<Map.Entry<String,String>>
HttpMessage.| Modifier and Type | Class and Description |
|---|---|
static class |
HttpHeaders.Names
Deprecated.
Use
HttpHeaderNames instead.
Standard HTTP header names. |
static class |
HttpHeaders.Values
Deprecated.
Use
HttpHeaderValues instead.
Standard HTTP header values. |
| Modifier and Type | Field and Description |
|---|---|
static HttpHeaders |
EMPTY_HEADERS
Deprecated.
Use
EmptyHttpHeaders.INSTANCE.
The instance is instantiated here to break the cyclic static initialization between |
| Modifier | Constructor and Description |
|---|---|
protected |
HttpHeaders() |
| Modifier and Type | Method and Description |
|---|---|
HttpHeaders |
add(CharSequence name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
HttpHeaders |
add(CharSequence name,
Object value)
Adds a new header with the specified name and value.
|
HttpHeaders |
add(HttpHeaders headers)
Adds all header entries of the specified
headers. |
abstract HttpHeaders |
add(String name,
Iterable<?> values) |
abstract HttpHeaders |
add(String name,
Object value) |
static void |
addDateHeader(HttpMessage message,
CharSequence name,
Date value)
Deprecated.
Use
add(CharSequence, Object) instead.
Adds a new date header with the specified name and value. The specified
value is formatted as defined in
RFC2616 |
static void |
addDateHeader(HttpMessage message,
String name,
Date value)
Deprecated.
Use
add(CharSequence, Object) instead. |
static void |
addHeader(HttpMessage message,
CharSequence name,
Object value)
Deprecated.
Use
add(CharSequence, Object) instead.
Adds a new header with the specified name and value.
If the specified value is not a 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. |
static void |
addHeader(HttpMessage message,
String name,
Object value)
Deprecated.
Use
add(CharSequence, Object) instead. |
abstract HttpHeaders |
addInt(CharSequence name,
int value)
Add the
name to value. |
static void |
addIntHeader(HttpMessage message,
CharSequence name,
int value)
Deprecated.
Use
addInt(CharSequence, int) instead.
Adds a new integer header with the specified name and value. |
static void |
addIntHeader(HttpMessage message,
String name,
int value)
Deprecated.
Use
add(CharSequence, Iterable) instead. |
abstract HttpHeaders |
addShort(CharSequence name,
short value)
Add the
name to value. |
abstract HttpHeaders |
clear()
Removes all headers from this
HttpMessage. |
static void |
clearHeaders(HttpMessage message)
Deprecated.
Use
clear() instead.
Removes all headers from the specified message. |
boolean |
contains(CharSequence name)
Checks to see if there is a header with the specified name
|
boolean |
contains(CharSequence name,
CharSequence value,
boolean ignoreCase)
Returns
true if a header with the name and value exists, false otherwise. |
abstract boolean |
contains(String name) |
boolean |
contains(String name,
String value,
boolean ignoreCase) |
boolean |
containsValue(CharSequence name,
CharSequence value,
boolean ignoreCase)
Returns
true if a header with the name and value exists, false otherwise. |
static void |
encodeAscii(CharSequence seq,
ByteBuf buf) |
abstract List<Map.Entry<String,String>> |
entries()
Returns a new
List that contains all headers in this object. |
static boolean |
equalsIgnoreCase(CharSequence name1,
CharSequence name2)
Deprecated.
|
String |
get(CharSequence name)
Returns the value of a header with the specified name.
|
String |
get(CharSequence name,
String defaultValue)
Returns the value of a header with the specified name.
|
abstract String |
get(String name) |
List<String> |
getAll(CharSequence name)
Returns the values of headers with the specified name
|
abstract List<String> |
getAll(String name) |
List<String> |
getAllAsString(CharSequence name)
|
String |
getAsString(CharSequence name)
Headers.get(Object) and convert the result to a String. |
static long |
getContentLength(HttpMessage message)
Deprecated.
Use
HttpUtil.getContentLength(HttpMessage) instead.
Returns the length of the content. Please note that this value is
not retrieved from ByteBufHolder.content() but from the
"Content-Length" header, and thus they are independent from each
other. |
static long |
getContentLength(HttpMessage message,
long defaultValue)
Deprecated.
Use
HttpUtil.getContentLength(HttpMessage, long) instead.
Returns the length of the content. Please note that this value is
not retrieved from ByteBufHolder.content() but from the
"Content-Length" header, and thus they are independent from each
other. |
static Date |
getDate(HttpMessage message)
Deprecated.
Use
getTimeMillis(CharSequence) instead.
Returns the value of the "Date" header. |
static Date |
getDate(HttpMessage message,
Date defaultValue)
Deprecated.
Use
getTimeMillis(CharSequence, long) instead.
Returns the value of the "Date" header. If there is no such
header or the header is not a formatted date, the defaultValue
is returned. |
static Date |
getDateHeader(HttpMessage message,
CharSequence name)
Deprecated.
Use
getTimeMillis(CharSequence) instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned. |
static Date |
getDateHeader(HttpMessage message,
CharSequence name,
Date defaultValue)
Deprecated.
Use
getTimeMillis(CharSequence, long) instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned. |
static Date |
getDateHeader(HttpMessage message,
String name)
Deprecated.
Use
getTimeMillis(CharSequence) instead. |
static Date |
getDateHeader(HttpMessage message,
String name,
Date defaultValue)
Deprecated.
Use
getTimeMillis(CharSequence, long) instead. |
static String |
getHeader(HttpMessage message,
CharSequence name)
Deprecated.
Use
get(CharSequence) instead.
Returns the header value with the specified header name. If there are
more than one header value for the specified header name, the first
value is returned. |
static String |
getHeader(HttpMessage message,
CharSequence name,
String defaultValue)
Deprecated.
Use
get(CharSequence, String) instead.
Returns the header value with the specified header name. If there are
more than one header value for the specified header name, the first
value is returned. |
static String |
getHeader(HttpMessage message,
String name)
Deprecated.
Use
get(CharSequence) instead. |
static String |
getHeader(HttpMessage message,
String name,
String defaultValue)
Deprecated.
Use
get(CharSequence, String) instead. |
static String |
getHost(HttpMessage message)
Deprecated.
Use
get(CharSequence) instead.
Returns the value of the "Host" header. |
static String |
getHost(HttpMessage message,
String defaultValue)
Deprecated.
Use
get(CharSequence, String) instead.
Returns the value of the "Host" header. If there is no such
header, the defaultValue is returned. |
abstract Integer |
getInt(CharSequence name)
Returns the integer value of a header with the specified name.
|
abstract int |
getInt(CharSequence name,
int defaultValue)
Returns the integer value of a header with the specified name.
|
static int |
getIntHeader(HttpMessage message,
CharSequence name)
Deprecated.
Use
getInt(CharSequence) instead.
Returns the integer header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned. |
static int |
getIntHeader(HttpMessage message,
CharSequence name,
int defaultValue)
Deprecated.
Use
getInt(CharSequence, int) instead.
Returns the integer header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned. |
static int |
getIntHeader(HttpMessage message,
String name)
Deprecated.
Use
getInt(CharSequence) instead. |
static int |
getIntHeader(HttpMessage message,
String name,
int defaultValue)
Deprecated.
Use
getInt(CharSequence, int) instead. |
abstract Short |
getShort(CharSequence name)
Returns the short value of a header with the specified name.
|
abstract short |
getShort(CharSequence name,
short defaultValue)
Returns the short value of a header with the specified name.
|
abstract Long |
getTimeMillis(CharSequence name)
Returns the date value of a header with the specified name.
|
abstract long |
getTimeMillis(CharSequence name,
long defaultValue)
Returns the date value of a header with the specified name.
|
static boolean |
is100ContinueExpected(HttpMessage message)
Deprecated.
Use
HttpUtil.is100ContinueExpected(HttpMessage) instead.
Returns true if and only if the specified message contains the
"Expect: 100-continue" header. |
static boolean |
isContentLengthSet(HttpMessage m)
Deprecated.
Use
HttpUtil.isContentLengthSet(HttpMessage) instead. |
abstract boolean |
isEmpty()
Checks if no header exists.
|
static boolean |
isKeepAlive(HttpMessage message)
Deprecated.
Use
HttpUtil.isKeepAlive(HttpMessage) instead.
Returns true if and only if the connection can remain open and
thus 'kept alive'. This methods respects the value of the
"Connection" header first and then the return value of
HttpVersion.isKeepAliveDefault(). |
static boolean |
isTransferEncodingChunked(HttpMessage message)
Deprecated.
Use
HttpUtil.isTransferEncodingChunked(HttpMessage) instead.
Checks to see if the transfer encoding in a specified HttpMessage is chunked |
abstract Iterator<Map.Entry<String,String>> |
iterator()
Deprecated.
It is preferred to use
iteratorCharSequence() unless you need String.
If String is required then use iteratorAsString(). |
Iterator<Map.Entry<String,String>> |
iteratorAsString()
|
abstract Iterator<Map.Entry<CharSequence,CharSequence>> |
iteratorCharSequence() |
abstract Set<String> |
names()
Returns a new
Set that contains the names of all headers in this object. |
static CharSequence |
newEntity(String name)
Deprecated.
Use
AsciiString instead.
Create a new |
HttpHeaders |
remove(CharSequence name)
Removes the header with the specified name.
|
abstract HttpHeaders |
remove(String name) |
static void |
removeHeader(HttpMessage message,
CharSequence name)
Deprecated.
Use
remove(CharSequence) instead.
Removes the header with the specified name. |
static void |
removeHeader(HttpMessage message,
String name)
Deprecated.
Use
remove(CharSequence) instead. |
static void |
removeTransferEncodingChunked(HttpMessage m)
Deprecated.
|
HttpHeaders |
set(CharSequence name,
Iterable<?> values)
Sets a header with the specified name and values.
|
HttpHeaders |
set(CharSequence name,
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. |
abstract HttpHeaders |
set(String name,
Iterable<?> values) |
abstract HttpHeaders |
set(String name,
Object value) |
static void |
set100ContinueExpected(HttpMessage message)
Deprecated.
Use
HttpUtil.set100ContinueExpected(HttpMessage, boolean) instead.
Sets the "Expect: 100-continue" header to the specified message.
If there is any existing "Expect" header, they are replaced with
the new one. |
static void |
set100ContinueExpected(HttpMessage message,
boolean set)
Deprecated.
Use
HttpUtil.set100ContinueExpected(HttpMessage, boolean) instead.
Sets or removes the "Expect: 100-continue" header to / from the
specified message. If set is true,
the "Expect: 100-continue" header is set and all other previous
"Expect" headers are removed. Otherwise, all "Expect"
headers are removed completely. |
HttpHeaders |
setAll(HttpHeaders headers)
Retains all current headers but calls
set(String, Object) for each entry in headers |
static void |
setContentLength(HttpMessage message,
long length)
Deprecated.
Use
HttpUtil.setContentLength(HttpMessage, long) instead. |
static void |
setDate(HttpMessage message,
Date value)
Deprecated.
Use
set(CharSequence, Object) instead.
Sets the "Date" header. |
static void |
setDateHeader(HttpMessage message,
CharSequence name,
Date value)
Deprecated.
Use
set(CharSequence, Object) instead.
Sets a new date header with the specified name and value. If there
is an existing header with the same name, the existing header is removed.
The specified value is formatted as defined in
RFC2616 |
static void |
setDateHeader(HttpMessage message,
CharSequence name,
Iterable<Date> values)
Deprecated.
Use
set(CharSequence, Iterable) instead.
Sets a new date header with the specified name and values. If there
is an existing header with the same name, the existing header is removed.
The specified values are formatted as defined in
RFC2616 |
static void |
setDateHeader(HttpMessage message,
String name,
Date value)
Deprecated.
Use
set(CharSequence, Object) instead. |
static void |
setDateHeader(HttpMessage message,
String name,
Iterable<Date> values)
Deprecated.
Use
set(CharSequence, Iterable) instead. |
static void |
setHeader(HttpMessage message,
CharSequence name,
Iterable<?> values)
Deprecated.
Use
set(CharSequence, Iterable) instead.
Sets a new header with the specified name and values. If there is an
existing header with the same name, the existing header is removed.
This getMethod can be represented approximately as the following code:
removeHeader(message, name);
for (Object v: values) {
if (v == null) {
break;
}
addHeader(message, name, v);
}
|
static void |
setHeader(HttpMessage message,
CharSequence name,
Object value)
Deprecated.
Use
set(CharSequence, Object) instead.
Sets a new header with the specified name and value. If there is an
existing header with the same name, the existing header is removed.
If the specified value is not a 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. |
static void |
setHeader(HttpMessage message,
String name,
Iterable<?> values)
Deprecated.
Use
set(CharSequence, Iterable) instead. |
static void |
setHeader(HttpMessage message,
String name,
Object value)
Deprecated.
Use
set(CharSequence, Object) instead. |
static void |
setHost(HttpMessage message,
CharSequence value)
Deprecated.
Use
set(CharSequence, Object) instead.
Sets the "Host" header. |
static void |
setHost(HttpMessage message,
String value)
Deprecated.
Use
set(CharSequence, Object) instead. |
abstract HttpHeaders |
setInt(CharSequence name,
int value)
Set the
name to value. |
static void |
setIntHeader(HttpMessage message,
CharSequence name,
int value)
Deprecated.
Use
setInt(CharSequence, int) instead.
Sets a new integer header with the specified name and value. If there
is an existing header with the same name, the existing header is removed. |
static void |
setIntHeader(HttpMessage message,
CharSequence name,
Iterable<Integer> values)
Deprecated.
Use
set(CharSequence, Iterable) instead.
Sets a new integer header with the specified name and values. If there
is an existing header with the same name, the existing header is removed. |
static void |
setIntHeader(HttpMessage message,
String name,
int value)
Deprecated.
Use
setInt(CharSequence, int) instead. |
static void |
setIntHeader(HttpMessage message,
String name,
Iterable<Integer> values)
Deprecated.
Use
set(CharSequence, Iterable) instead. |
static void |
setKeepAlive(HttpMessage message,
boolean keepAlive)
Deprecated.
Use
HttpUtil.setKeepAlive(HttpMessage, boolean) instead.
Sets the value of the "Connection" header depending on the
protocol version of the specified message. This getMethod sets or removes
the "Connection" header depending on what the default keep alive
mode of the message's protocol version is, as specified by
HttpVersion.isKeepAliveDefault().
|
abstract HttpHeaders |
setShort(CharSequence name,
short value)
Set the
name to value. |
static void |
setTransferEncodingChunked(HttpMessage m)
Deprecated.
|
abstract int |
size()
Returns the number of headers in this object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliterator@Deprecated public static final HttpHeaders EMPTY_HEADERS
EmptyHttpHeaders.INSTANCE.
The instance is instantiated here to break the cyclic static initialization between EmptyHttpHeaders and
HttpHeaders. The issue is that if someone accesses EmptyHttpHeaders.INSTANCE before
EMPTY_HEADERS then EMPTY_HEADERS will be null.
@Deprecated public static boolean isKeepAlive(HttpMessage message)
HttpUtil.isKeepAlive(HttpMessage) instead.
Returns true if and only if the connection can remain open and
thus 'kept alive'. This methods respects the value of the
"Connection" header first and then the return value of
HttpVersion.isKeepAliveDefault().@Deprecated public static void setKeepAlive(HttpMessage message, boolean keepAlive)
HttpUtil.setKeepAlive(HttpMessage, boolean) instead.
Sets the value of the "Connection" header depending on the
protocol version of the specified message. This getMethod sets or removes
the "Connection" header depending on what the default keep alive
mode of the message's protocol version is, as specified by
HttpVersion.isKeepAliveDefault().
"close" if keepAlive is false."keep-alive" if keepAlive is true.@Deprecated public static String getHeader(HttpMessage message, String name)
get(CharSequence) instead.@Deprecated public static String getHeader(HttpMessage message, CharSequence name)
get(CharSequence) instead.
Returns the header value with the specified header name. If there are
more than one header value for the specified header name, the first
value is returned.null if there is no such header@Deprecated public static String getHeader(HttpMessage message, String name, String defaultValue)
get(CharSequence, String) instead.@Deprecated public static String getHeader(HttpMessage message, CharSequence name, String defaultValue)
get(CharSequence, String) instead.
Returns the header value with the specified header name. If there are
more than one header value for the specified header name, the first
value is returned.defaultValue if there is no such
header@Deprecated public static void setHeader(HttpMessage message, String name, Object value)
set(CharSequence, Object) instead.@Deprecated public static void setHeader(HttpMessage message, CharSequence name, Object value)
set(CharSequence, Object) instead.
Sets a new header with the specified name and value. If there is an
existing header with the same name, the existing header is removed.
If the specified value is not a 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.@Deprecated public static void setHeader(HttpMessage message, String name, Iterable<?> values)
set(CharSequence, Iterable) instead.@Deprecated public static void setHeader(HttpMessage message, CharSequence name, Iterable<?> values)
set(CharSequence, Iterable) instead.
Sets a new header with the specified name and values. If there is an
existing header with the same name, the existing header is removed.
This getMethod can be represented approximately as the following code:
removeHeader(message, name);
for (Object v: values) {
if (v == null) {
break;
}
addHeader(message, name, v);
}
@Deprecated public static void addHeader(HttpMessage message, String name, Object value)
add(CharSequence, Object) instead.@Deprecated public static void addHeader(HttpMessage message, CharSequence name, Object value)
add(CharSequence, Object) instead.
Adds a new header with the specified name and value.
If the specified value is not a 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.@Deprecated public static void removeHeader(HttpMessage message, String name)
remove(CharSequence) instead.removeHeader(HttpMessage, CharSequence)@Deprecated public static void removeHeader(HttpMessage message, CharSequence name)
remove(CharSequence) instead.
Removes the header with the specified name.@Deprecated public static void clearHeaders(HttpMessage message)
clear() instead.
Removes all headers from the specified message.@Deprecated public static int getIntHeader(HttpMessage message, String name)
getInt(CharSequence) instead.getIntHeader(HttpMessage, CharSequence)@Deprecated public static int getIntHeader(HttpMessage message, CharSequence name)
getInt(CharSequence) instead.
Returns the integer header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.NumberFormatException - if there is no such header or the header value is not a number@Deprecated public static int getIntHeader(HttpMessage message, String name, int defaultValue)
getInt(CharSequence, int) instead.@Deprecated public static int getIntHeader(HttpMessage message, CharSequence name, int defaultValue)
getInt(CharSequence, int) instead.
Returns the integer header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.defaultValue if there is no such
header or the header value is not a number@Deprecated public static void setIntHeader(HttpMessage message, String name, int value)
setInt(CharSequence, int) instead.@Deprecated public static void setIntHeader(HttpMessage message, CharSequence name, int value)
setInt(CharSequence, int) instead.
Sets a new integer header with the specified name and value. If there
is an existing header with the same name, the existing header is removed.@Deprecated public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values)
set(CharSequence, Iterable) instead.@Deprecated public static void setIntHeader(HttpMessage message, CharSequence name, Iterable<Integer> values)
set(CharSequence, Iterable) instead.
Sets a new integer header with the specified name and values. If there
is an existing header with the same name, the existing header is removed.@Deprecated public static void addIntHeader(HttpMessage message, String name, int value)
add(CharSequence, Iterable) instead.@Deprecated public static void addIntHeader(HttpMessage message, CharSequence name, int value)
addInt(CharSequence, int) instead.
Adds a new integer header with the specified name and value.@Deprecated public static Date getDateHeader(HttpMessage message, String name) throws ParseException
getTimeMillis(CharSequence) instead.ParseExceptiongetDateHeader(HttpMessage, CharSequence)@Deprecated public static Date getDateHeader(HttpMessage message, CharSequence name) throws ParseException
getTimeMillis(CharSequence) instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.ParseException - if there is no such header or the header value is not a formatted date@Deprecated public static Date getDateHeader(HttpMessage message, String name, Date defaultValue)
getTimeMillis(CharSequence, long) instead.@Deprecated public static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue)
getTimeMillis(CharSequence, long) instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.defaultValue if there is no such
header or the header value is not a formatted date@Deprecated public static void setDateHeader(HttpMessage message, String name, Date value)
set(CharSequence, Object) instead.@Deprecated public static void setDateHeader(HttpMessage message, CharSequence name, Date value)
set(CharSequence, Object) instead.
Sets a new date header with the specified name and value. If there
is an existing header with the same name, the existing header is removed.
The specified value is formatted as defined in
RFC2616@Deprecated public static void setDateHeader(HttpMessage message, String name, Iterable<Date> values)
set(CharSequence, Iterable) instead.@Deprecated public static void setDateHeader(HttpMessage message, CharSequence name, Iterable<Date> values)
set(CharSequence, Iterable) instead.
Sets a new date header with the specified name and values. If there
is an existing header with the same name, the existing header is removed.
The specified values are formatted as defined in
RFC2616@Deprecated public static void addDateHeader(HttpMessage message, String name, Date value)
add(CharSequence, Object) instead.@Deprecated public static void addDateHeader(HttpMessage message, CharSequence name, Date value)
add(CharSequence, Object) instead.
Adds a new date header with the specified name and value. The specified
value is formatted as defined in
RFC2616@Deprecated public static long getContentLength(HttpMessage message)
HttpUtil.getContentLength(HttpMessage) instead.
Returns the length of the content. Please note that this value is
not retrieved from ByteBufHolder.content() but from the
"Content-Length" header, and thus they are independent from each
other.NumberFormatException - if the message does not have the "Content-Length" header
or its value is not a number@Deprecated public static long getContentLength(HttpMessage message, long defaultValue)
HttpUtil.getContentLength(HttpMessage, long) instead.
Returns the length of the content. Please note that this value is
not retrieved from ByteBufHolder.content() but from the
"Content-Length" header, and thus they are independent from each
other.defaultValue if this message does
not have the "Content-Length" header or its value is not
a number@Deprecated public static void setContentLength(HttpMessage message, long length)
HttpUtil.setContentLength(HttpMessage, long) instead.@Deprecated public static String getHost(HttpMessage message)
get(CharSequence) instead.
Returns the value of the "Host" header.@Deprecated public static String getHost(HttpMessage message, String defaultValue)
get(CharSequence, String) instead.
Returns the value of the "Host" header. If there is no such
header, the defaultValue is returned.@Deprecated public static void setHost(HttpMessage message, String value)
set(CharSequence, Object) instead.setHost(HttpMessage, CharSequence)@Deprecated public static void setHost(HttpMessage message, CharSequence value)
set(CharSequence, Object) instead.
Sets the "Host" header.@Deprecated public static Date getDate(HttpMessage message) throws ParseException
getTimeMillis(CharSequence) instead.
Returns the value of the "Date" header.ParseException - if there is no such header or the header value is not a formatted date@Deprecated public static Date getDate(HttpMessage message, Date defaultValue)
getTimeMillis(CharSequence, long) instead.
Returns the value of the "Date" header. If there is no such
header or the header is not a formatted date, the defaultValue
is returned.@Deprecated public static void setDate(HttpMessage message, Date value)
set(CharSequence, Object) instead.
Sets the "Date" header.@Deprecated public static boolean is100ContinueExpected(HttpMessage message)
HttpUtil.is100ContinueExpected(HttpMessage) instead.
Returns true if and only if the specified message contains the
"Expect: 100-continue" header.@Deprecated public static void set100ContinueExpected(HttpMessage message)
HttpUtil.set100ContinueExpected(HttpMessage, boolean) instead.
Sets the "Expect: 100-continue" header to the specified message.
If there is any existing "Expect" header, they are replaced with
the new one.@Deprecated public static void set100ContinueExpected(HttpMessage message, boolean set)
HttpUtil.set100ContinueExpected(HttpMessage, boolean) instead.
Sets or removes the "Expect: 100-continue" header to / from the
specified message. If set is true,
the "Expect: 100-continue" header is set and all other previous
"Expect" headers are removed. Otherwise, all "Expect"
headers are removed completely.@Deprecated public static boolean isTransferEncodingChunked(HttpMessage message)
HttpUtil.isTransferEncodingChunked(HttpMessage) instead.
Checks to see if the transfer encoding in a specified HttpMessage is chunkedmessage - The message to check@Deprecated public static void removeTransferEncodingChunked(HttpMessage m)
HttpUtil.setTransferEncodingChunked(HttpMessage, boolean) instead.@Deprecated public static void setTransferEncodingChunked(HttpMessage m)
HttpUtil.setTransferEncodingChunked(HttpMessage, boolean) instead.@Deprecated public static boolean isContentLengthSet(HttpMessage m)
HttpUtil.isContentLengthSet(HttpMessage) instead.@Deprecated public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2)
AsciiString.contentEqualsIgnoreCase(CharSequence, CharSequence) instead.public static void encodeAscii(CharSequence seq, ByteBuf buf)
@Deprecated public static CharSequence newEntity(String name)
AsciiString instead.
Create a new CharSequence which is optimized for reuse as HttpHeaders name or value.
So if you have a Header name or value that you want to reuse you should make use of this.
public abstract String get(String name)
get(CharSequence)public String get(CharSequence name)
name - The name of the header to searchnull if there is no such headergetAsString(CharSequence)public String get(CharSequence name, String defaultValue)
name - The name of the header to searchdefaultValue if there is no such headerpublic abstract Integer getInt(CharSequence name)
name - the name of the header to searchnull if there's no
such header or its value is not an integer.public abstract int getInt(CharSequence name, int defaultValue)
name - the name of the header to searchdefaultValue - the default valuedefaultValue if
there's no such header or its value is not an integer.public abstract Short getShort(CharSequence name)
name - the name of the header to searchnull if there's no
such header or its value is not a short.public abstract short getShort(CharSequence name, short defaultValue)
name - the name of the header to searchdefaultValue - the default valuedefaultValue if
there's no such header or its value is not a short.public abstract Long getTimeMillis(CharSequence name)
name - the name of the header to searchnull if there's no
such header or its value is not a date.public abstract long getTimeMillis(CharSequence name, long defaultValue)
name - the name of the header to searchdefaultValue - the default valuedefaultValue if
there's no such header or its value is not a date.public abstract List<String> getAll(String name)
getAll(CharSequence)public List<String> getAll(CharSequence name)
name - The name of the headers to searchList of header values which will be empty if no values
are foundgetAllAsString(CharSequence)public abstract List<Map.Entry<String,String>> entries()
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 iterator() instead, which has much less overhead.iteratorCharSequence()public abstract boolean contains(String name)
contains(CharSequence)@Deprecated public abstract Iterator<Map.Entry<String,String>> iterator()
iteratorCharSequence() unless you need String.
If String is required then use iteratorAsString().public abstract Iterator<Map.Entry<CharSequence,CharSequence>> iteratorCharSequence()
public boolean contains(CharSequence name)
name - The name of the header to search forpublic abstract boolean isEmpty()
public abstract int size()
public abstract Set<String> names()
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 iterator() instead, which has much less overhead.public abstract HttpHeaders add(String name, Object value)
add(CharSequence, Object)public HttpHeaders add(CharSequence name, Object value)
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.name - The name of the header being addedvalue - The value of the header being addedthispublic abstract HttpHeaders add(String name, Iterable<?> values)
add(CharSequence, Iterable)public HttpHeaders add(CharSequence name, Iterable<?> values)
for (Object v: values) {
if (v == null) {
break;
}
headers.add(name, v);
}
name - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders add(HttpHeaders headers)
headers.thispublic abstract HttpHeaders addInt(CharSequence name, int value)
name to value.name - The name to modifyvalue - The valuethispublic abstract HttpHeaders addShort(CharSequence name, short value)
name to value.name - The name to modifyvalue - The valuethispublic abstract HttpHeaders set(String name, Object value)
set(CharSequence, Object)public HttpHeaders set(CharSequence name, Object value)
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.name - The name of the header being setvalue - The value of the header being setthispublic abstract HttpHeaders set(String name, Iterable<?> values)
set(CharSequence, Iterable)public HttpHeaders set(CharSequence name, Iterable<?> values)
headers.remove(name);
for (Object v: values) {
if (v == null) {
break;
}
headers.add(name, v);
}
name - The name of the headers being setvalues - The values of the headers being setthispublic HttpHeaders set(HttpHeaders headers)
headers.thispublic HttpHeaders setAll(HttpHeaders headers)
set(String, Object) for each entry in headersheaders - The headers used to set(String, Object) values in this instancethispublic abstract HttpHeaders setInt(CharSequence name, int value)
name to value. This will remove all previous values associated with name.name - The name to modifyvalue - The valuethispublic abstract HttpHeaders setShort(CharSequence name, short value)
name to value. This will remove all previous values associated with name.name - The name to modifyvalue - The valuethispublic abstract HttpHeaders remove(String name)
remove(CharSequence)public HttpHeaders remove(CharSequence name)
name - The name of the header to removethispublic abstract HttpHeaders clear()
HttpMessage.thispublic boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase)
true if a header with the name and value exists, false otherwise.
This also handles multiple values that are separated with a ,.
If ignoreCase is true then a case insensitive compare is done on the value.
name - the name of the header to findvalue - the value of the header to findignoreCase - true then a case insensitive compare is run to compare values.
otherwise a case sensitive compare is run to compare values.public final String getAsString(CharSequence name)
Headers.get(Object) and convert the result to a String.name - the name of the header to retrievenull if there's no such header.public final List<String> getAllAsString(CharSequence name)
public boolean contains(CharSequence name, CharSequence value, boolean ignoreCase)
true if a header with the name and value exists, false otherwise.
If ignoreCase is true then a case insensitive compare is done on the value.
name - the name of the header to findvalue - the value of the header to findignoreCase - true then a case insensitive compare is run to compare values.
otherwise a case sensitive compare is run to compare values.Copyright © 2008–2017 The Netty Project. All rights reserved.