Package io.netty.handler.codec.http
Class EmptyHttpHeaders
- java.lang.Object
-
- io.netty.handler.codec.http.HttpHeaders
-
- io.netty.handler.codec.http.EmptyHttpHeaders
-
- All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>>
public class EmptyHttpHeaders extends HttpHeaders
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.handler.codec.http.HttpHeaders
HttpHeaders.Names, HttpHeaders.Values
-
-
Field Summary
Fields Modifier and Type Field Description static EmptyHttpHeadersINSTANCE-
Fields inherited from class io.netty.handler.codec.http.HttpHeaders
EMPTY_HEADERS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEmptyHttpHeaders()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeadersadd(java.lang.String name, java.lang.Iterable<?> values)HttpHeadersadd(java.lang.String name, java.lang.Object value)HttpHeadersaddInt(java.lang.CharSequence name, int value)Add thenametovalue.HttpHeadersaddShort(java.lang.CharSequence name, short value)Add thenametovalue.HttpHeadersclear()Removes all headers from thisHttpMessage.booleancontains(java.lang.String name)java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>>entries()Returns a newListthat contains all headers in this object.java.lang.Stringget(java.lang.String name)java.util.List<java.lang.String>getAll(java.lang.String name)java.lang.IntegergetInt(java.lang.CharSequence name)Returns the integer value of a header with the specified name.intgetInt(java.lang.CharSequence name, int defaultValue)Returns the integer value of a header with the specified name.java.lang.ShortgetShort(java.lang.CharSequence name)Returns the short value of a header with the specified name.shortgetShort(java.lang.CharSequence name, short defaultValue)Returns the short value of a header with the specified name.java.lang.LonggetTimeMillis(java.lang.CharSequence name)Returns the date value of a header with the specified name.longgetTimeMillis(java.lang.CharSequence name, long defaultValue)Returns the date value of a header with the specified name.booleanisEmpty()Checks if no header exists.java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>>iterator()java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>>iteratorCharSequence()java.util.Set<java.lang.String>names()Returns a newSetthat contains the names of all headers in this object.HttpHeadersremove(java.lang.String name)HttpHeadersset(java.lang.String name, java.lang.Iterable<?> values)HttpHeadersset(java.lang.String name, java.lang.Object value)HttpHeaderssetInt(java.lang.CharSequence name, int value)Set thenametovalue.HttpHeaderssetShort(java.lang.CharSequence name, short value)Set thenametovalue.intsize()Returns the number of headers in this object.-
Methods inherited from class io.netty.handler.codec.http.HttpHeaders
add, add, add, addDateHeader, addDateHeader, addHeader, addHeader, addIntHeader, addIntHeader, clearHeaders, contains, contains, contains, containsValue, copy, encodeAscii, equalsIgnoreCase, get, get, getAll, getAllAsString, getAsString, getContentLength, getContentLength, getDate, getDate, getDateHeader, getDateHeader, getDateHeader, getDateHeader, getHeader, getHeader, getHeader, getHeader, getHost, getHost, getIntHeader, getIntHeader, getIntHeader, getIntHeader, is100ContinueExpected, isContentLengthSet, isKeepAlive, isTransferEncodingChunked, iteratorAsString, newEntity, remove, removeHeader, removeHeader, removeTransferEncodingChunked, set, set, set, set100ContinueExpected, set100ContinueExpected, setAll, setContentLength, setDate, setDateHeader, setDateHeader, setDateHeader, setDateHeader, setHeader, setHeader, setHeader, setHeader, setHost, setHost, setIntHeader, setIntHeader, setIntHeader, setIntHeader, setKeepAlive, setTransferEncodingChunked, toString, valueCharSequenceIterator, valueStringIterator
-
-
-
-
Field Detail
-
INSTANCE
public static final EmptyHttpHeaders INSTANCE
-
-
Method Detail
-
get
public java.lang.String get(java.lang.String name)
- Specified by:
getin classHttpHeaders- See Also:
HttpHeaders.get(CharSequence)
-
getInt
public java.lang.Integer getInt(java.lang.CharSequence name)
Description copied from class:HttpHeadersReturns the integer 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:
getIntin classHttpHeaders- Parameters:
name- the name of the header to search- Returns:
- the first header value if the header is found and its value is an integer.
nullif there's no such header or its value is not an integer.
-
getInt
public int getInt(java.lang.CharSequence name, int defaultValue)Description copied from class:HttpHeadersReturns the integer 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:
getIntin classHttpHeaders- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the first header value if the header is found and its value is an integer.
defaultValueif there's no such header or its value is not an integer.
-
getShort
public java.lang.Short getShort(java.lang.CharSequence name)
Description copied from class:HttpHeadersReturns the short 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:
getShortin classHttpHeaders- Parameters:
name- the name of the header to search- Returns:
- the first header value if the header is found and its value is a short.
nullif there's no such header or its value is not a short.
-
getShort
public short getShort(java.lang.CharSequence name, short defaultValue)Description copied from class:HttpHeadersReturns the short 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:
getShortin classHttpHeaders- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the first header value if the header is found and its value is a short.
defaultValueif there's no such header or its value is not a short.
-
getTimeMillis
public java.lang.Long getTimeMillis(java.lang.CharSequence name)
Description copied from class:HttpHeadersReturns the date 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:
getTimeMillisin classHttpHeaders- Parameters:
name- the name of the header to search- Returns:
- the first header value if the header is found and its value is a date.
nullif there's no such header or its value is not a date.
-
getTimeMillis
public long getTimeMillis(java.lang.CharSequence name, long defaultValue)Description copied from class:HttpHeadersReturns the date 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:
getTimeMillisin classHttpHeaders- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the first header value if the header is found and its value is a date.
defaultValueif there's no such header or its value is not a date.
-
getAll
public java.util.List<java.lang.String> getAll(java.lang.String name)
- Specified by:
getAllin classHttpHeaders- See Also:
HttpHeaders.getAll(CharSequence)
-
entries
public java.util.List<java.util.Map.Entry<java.lang.String,java.lang.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, useHttpHeaders.iterator()instead, which has much less overhead.- Specified by:
entriesin classHttpHeaders- See Also:
HttpHeaders.iteratorCharSequence()
-
contains
public boolean contains(java.lang.String name)
- Specified by:
containsin classHttpHeaders- See Also:
HttpHeaders.contains(CharSequence)
-
isEmpty
public boolean isEmpty()
Description copied from class:HttpHeadersChecks if no header exists.- Specified by:
isEmptyin classHttpHeaders
-
size
public int size()
Description copied from class:HttpHeadersReturns the number of headers in this object.- Specified by:
sizein classHttpHeaders
-
names
public java.util.Set<java.lang.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, useHttpHeaders.iterator()instead, which has much less overhead.- Specified by:
namesin classHttpHeaders
-
add
public HttpHeaders add(java.lang.String name, java.lang.Object value)
- Specified by:
addin classHttpHeaders- See Also:
HttpHeaders.add(CharSequence, Object)
-
add
public HttpHeaders add(java.lang.String name, java.lang.Iterable<?> values)
- Specified by:
addin classHttpHeaders- See Also:
HttpHeaders.add(CharSequence, Iterable)
-
addInt
public HttpHeaders addInt(java.lang.CharSequence name, int value)
Description copied from class:HttpHeadersAdd thenametovalue.- Specified by:
addIntin classHttpHeaders- Parameters:
name- The name to modifyvalue- The value- Returns:
this
-
addShort
public HttpHeaders addShort(java.lang.CharSequence name, short value)
Description copied from class:HttpHeadersAdd thenametovalue.- Specified by:
addShortin classHttpHeaders- Parameters:
name- The name to modifyvalue- The value- Returns:
this
-
set
public HttpHeaders set(java.lang.String name, java.lang.Object value)
- Specified by:
setin classHttpHeaders- See Also:
HttpHeaders.set(CharSequence, Object)
-
set
public HttpHeaders set(java.lang.String name, java.lang.Iterable<?> values)
- Specified by:
setin classHttpHeaders- See Also:
HttpHeaders.set(CharSequence, Iterable)
-
setInt
public HttpHeaders setInt(java.lang.CharSequence name, int value)
Description copied from class:HttpHeadersSet thenametovalue. This will remove all previous values associated withname.- Specified by:
setIntin classHttpHeaders- Parameters:
name- The name to modifyvalue- The value- Returns:
this
-
setShort
public HttpHeaders setShort(java.lang.CharSequence name, short value)
Description copied from class:HttpHeadersSet thenametovalue. This will remove all previous values associated withname.- Specified by:
setShortin classHttpHeaders- Parameters:
name- The name to modifyvalue- The value- Returns:
this
-
remove
public HttpHeaders remove(java.lang.String name)
- Specified by:
removein classHttpHeaders- See Also:
HttpHeaders.remove(CharSequence)
-
clear
public HttpHeaders clear()
Description copied from class:HttpHeadersRemoves all headers from thisHttpMessage.- Specified by:
clearin classHttpHeaders- Returns:
this
-
iterator
public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>>- Specified by:
iteratorin classHttpHeaders
-
iteratorCharSequence
public java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>> iteratorCharSequence()
- Specified by:
iteratorCharSequencein classHttpHeaders- Returns:
- Iterator over the name/value header pairs.
-
-