Class DefaultHttpHeaders
- java.lang.Object
-
- org.jboss.netty.handler.codec.http.HttpHeaders
-
- org.jboss.netty.handler.codec.http.DefaultHttpHeaders
-
public class DefaultHttpHeaders extends HttpHeaders
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.netty.handler.codec.http.HttpHeaders
HttpHeaders.Names, HttpHeaders.Values
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanvalidate-
Fields inherited from class org.jboss.netty.handler.codec.http.HttpHeaders
EMPTY_HEADERS
-
-
Constructor Summary
Constructors Constructor Description DefaultHttpHeaders()DefaultHttpHeaders(boolean validate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeadersadd(String name, Iterable<?> values)Adds a new header with the specified name and values.HttpHeadersadd(String name, Object value)Adds a new header with the specified name and value.HttpHeadersclear()Removes all headers from thisHttpMessage.booleancontains(String name)Checks to see if there is a header with the specified namebooleancontains(String name, String value, boolean ignoreCaseValue)Returnstrueif a header with the name and value exists.List<Map.Entry<String,String>>entries()Returns a newListthat contains all headers in this object.Stringget(String name)Returns the value of a header with the specified name.List<String>getAll(String name)Returns the values of headers with the specified namebooleanisEmpty()Checks if no header exists.Iterator<Map.Entry<String,String>>iterator()Set<String>names()Returns a newSetthat contains the names of all headers in this object.HttpHeadersremove(String name)Removes the header with the specified name.HttpHeadersset(String name, Iterable<?> values)Sets a header with the specified name and values.HttpHeadersset(String name, Object value)Sets a header with the specified name and value.-
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
-
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
-
-
-
-
Method Detail
-
add
public HttpHeaders add(String name, Object value)
Description copied from class:HttpHeadersAdds a new header with the specified name and value. If the specified value is not aString, it is converted into aStringbyObject.toString(), except in the cases ofDateandCalendar, which are formatted to the date format defined in RFC2616.- Specified by:
addin classHttpHeaders- Parameters:
name- The name of the header being addedvalue- The value of the header being added- Returns:
this
-
add
public HttpHeaders add(String name, Iterable<?> values)
Description copied from class:HttpHeadersAdds 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:
addin classHttpHeaders- Parameters:
name- The name of the headers being setvalues- The values of the headers being set- Returns:
this
-
remove
public HttpHeaders remove(String name)
Description copied from class:HttpHeadersRemoves the header with the specified name.- Specified by:
removein classHttpHeaders- Parameters:
name- The name of the header to remove- Returns:
this
-
set
public HttpHeaders set(String name, Object value)
Description copied from class:HttpHeadersSets 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 aStringbyObject.toString(), except forDateandCalendar, which are formatted to the date format defined in RFC2616.- Specified by:
setin classHttpHeaders- Parameters:
name- The name of the header being setvalue- The value of the header being set- Returns:
this
-
set
public HttpHeaders set(String name, Iterable<?> values)
Description copied from class:HttpHeadersSets 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:
setin classHttpHeaders- Parameters:
name- The name of the headers being setvalues- The values of the headers being set- Returns:
this
-
clear
public HttpHeaders clear()
Description copied from class:HttpHeadersRemoves all headers from thisHttpMessage.- Specified by:
clearin classHttpHeaders- Returns:
this
-
get
public String get(String name)
Description copied from class:HttpHeadersReturns 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:
getin classHttpHeaders- Parameters:
name- The name of the header to search- Returns:
- The first header value or
nullif there is no such header
-
getAll
public List<String> getAll(String name)
Description copied from class:HttpHeadersReturns the values of headers with the specified name- Specified by:
getAllin classHttpHeaders- Parameters:
name- The name of the headers to search- Returns:
- A
Listof header values which will be empty if no values are found
-
entries
public List<Map.Entry<String,String>> entries()
Description copied from class:HttpHeadersReturns a newListthat contains all headers in this object. Note that modifying the returnedListwill 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:
entriesin classHttpHeaders
-
contains
public boolean contains(String name)
Description copied from class:HttpHeadersChecks to see if there is a header with the specified name- Specified by:
containsin 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:HttpHeadersChecks if no header exists.- Specified by:
isEmptyin classHttpHeaders
-
contains
public boolean contains(String name, String value, boolean ignoreCaseValue)
Description copied from class:HttpHeadersReturnstrueif a header with the name and value exists.- Overrides:
containsin classHttpHeaders- Parameters:
name- the headernamevalue- the valueignoreCaseValue-trueif case should be ignored- Returns:
- contains
trueif it contains itfalseotherwise
-
names
public Set<String> names()
Description copied from class:HttpHeadersReturns a newSetthat contains the names of all headers in this object. Note that modifying the returnedSetwill 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:
namesin classHttpHeaders
-
-