Class DefaultHttpHeaders
java.lang.Object
org.jboss.netty.handler.codec.http.HttpHeaders
org.jboss.netty.handler.codec.http.DefaultHttpHeaders
- Direct Known Subclasses:
DefaultHttpChunkTrailer.TrailingHeaders
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private final class
Nested classes/interfaces inherited from class org.jboss.netty.handler.codec.http.HttpHeaders
HttpHeaders.Names, HttpHeaders.Values
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final DefaultHttpHeaders.HeaderEntry[]
private final DefaultHttpHeaders.HeaderEntry
protected final boolean
Fields inherited from class org.jboss.netty.handler.codec.http.HttpHeaders
EMPTY_HEADERS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new header with the specified name and values.Adds a new header with the specified name and value.private void
clear()
Removes all headers from thisHttpMessage
.boolean
Checks to see if there is a header with the specified nameboolean
Returnstrue
if a header with the name and value exists.entries()
Returns a newList
that contains all headers in this object.private static boolean
Returns the value of a header with the specified name.private String
Returns the values of headers with the specified nameprivate static int
private static int
index
(int hash) boolean
isEmpty()
Checks if no header exists.iterator()
names()
Returns a newSet
that contains the names of all headers in this object.Removes the header with the specified name.private void
Sets a header with the specified name and values.Sets a header with the specified name and value.private static char
toLowerCase
(char c) private static String
(package private) void
validateHeaderValue0
(String headerValue) Methods inherited from class org.jboss.netty.handler.codec.http.HttpHeaders
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, validateHeaderName, validateHeaderValue, valideHeaderNameChar
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
BUCKET_SIZE
private static final int BUCKET_SIZE- See Also:
-
KNOWN_NAMES
-
KNOWN_VALUES
-
entries
-
head
-
validate
protected final boolean validate
-
-
Constructor Details
-
DefaultHttpHeaders
public DefaultHttpHeaders() -
DefaultHttpHeaders
public DefaultHttpHeaders(boolean validate)
-
-
Method Details
-
createSet
-
hash
-
eq
-
toLowerCase
private static char toLowerCase(char c) -
index
private static int index(int hash) -
validateHeaderValue0
-
add
Description copied from class:HttpHeaders
Adds a new header with the specified name and value. If the specified value is not aString
, it is converted into aString
byObject.toString()
, except in the cases ofDate
andCalendar
, which are formatted to the date format defined in RFC2616.- Specified by:
add
in classHttpHeaders
- Parameters:
name
- The name of the header being addedvalue
- The value of the header being added- Returns:
this
-
add
Description copied from class:HttpHeaders
Adds a new header with the specified name and values. This getMethod can be represented approximately as the following code:for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
- Specified by:
add
in classHttpHeaders
- Parameters:
name
- The name of the headers being setvalues
- The values of the headers being set- Returns:
this
-
add0
-
remove
Description copied from class:HttpHeaders
Removes the header with the specified name.- Specified by:
remove
in classHttpHeaders
- Parameters:
name
- The name of the header to remove- Returns:
this
-
remove0
-
set
Description copied from class:HttpHeaders
Sets a header with the specified name and value. If there is an existing header with the same name, it is removed. If the specified value is not aString
, it is converted into aString
byObject.toString()
, except forDate
andCalendar
, which are formatted to the date format defined in RFC2616.- Specified by:
set
in classHttpHeaders
- Parameters:
name
- The name of the header being setvalue
- The value of the header being set- Returns:
this
-
set
Description copied from class:HttpHeaders
Sets a header with the specified name and values. If there is an existing header with the same name, it is removed. This getMethod can be represented approximately as the following code:headers.remove(name); for (Object v: values) { if (v == null) { break; } headers.add(name, v); }
- Specified by:
set
in classHttpHeaders
- Parameters:
name
- The name of the headers being setvalues
- The values of the headers being set- Returns:
this
-
clear
Description copied from class:HttpHeaders
Removes all headers from thisHttpMessage
.- Specified by:
clear
in classHttpHeaders
- Returns:
this
-
get
Description copied from class:HttpHeaders
Returns the value of a header with the specified name. If there are more than one values for the specified name, the first value is returned.- Specified by:
get
in classHttpHeaders
- Parameters:
name
- The name of the header to search- Returns:
- The first header value or
null
if there is no such header
-
get
-
getAll
Description copied from class:HttpHeaders
Returns the values of headers with the specified name- Specified by:
getAll
in classHttpHeaders
- Parameters:
name
- The name of the headers to search- Returns:
- A
List
of header values which will be empty if no values are found
-
entries
Description copied from class:HttpHeaders
Returns a newList
that contains all headers in this object. Note that modifying the returnedList
will not affect the state of this object. If you intend to enumerate over the header entries only, useIterable.iterator()
instead, which has much less overhead.- Specified by:
entries
in classHttpHeaders
-
iterator
-
contains
Description copied from class:HttpHeaders
Checks to see if there is a header with the specified name- Specified by:
contains
in classHttpHeaders
- Parameters:
name
- The name of the header to search for- Returns:
- True if at least one header is found
-
isEmpty
public boolean isEmpty()Description copied from class:HttpHeaders
Checks if no header exists.- Specified by:
isEmpty
in classHttpHeaders
-
contains
Description copied from class:HttpHeaders
Returnstrue
if a header with the name and value exists.- Overrides:
contains
in classHttpHeaders
- Parameters:
name
- the headernamevalue
- the valueignoreCaseValue
-true
if case should be ignored- Returns:
- contains
true
if it contains itfalse
otherwise
-
names
Description copied from class:HttpHeaders
Returns a newSet
that contains the names of all headers in this object. Note that modifying the returnedSet
will not affect the state of this object. If you intend to enumerate over the header entries only, useIterable.iterator()
instead, which has much less overhead.- Specified by:
names
in classHttpHeaders
-
toString
-