Package io.netty.handler.codec.http
Class DefaultLastHttpContent
- java.lang.Object
-
- io.netty.handler.codec.http.DefaultHttpObject
-
- io.netty.handler.codec.http.DefaultHttpContent
-
- io.netty.handler.codec.http.DefaultLastHttpContent
-
- All Implemented Interfaces:
ByteBufHolder
,DecoderResultProvider
,HttpContent
,HttpObject
,LastHttpContent
,ReferenceCounted
public class DefaultLastHttpContent extends DefaultHttpContent implements LastHttpContent
The defaultLastHttpContent
implementation.
-
-
Field Summary
-
Fields inherited from interface io.netty.handler.codec.http.LastHttpContent
EMPTY_LAST_CONTENT
-
-
Constructor Summary
Constructors Constructor Description DefaultLastHttpContent()
Create a new empty, last HTTP content message.DefaultLastHttpContent(ByteBuf content)
Create a new last HTTP content message with the given contents.DefaultLastHttpContent(ByteBuf content, boolean validateHeaders)
Deprecated.Prefer theDefaultLastHttpContent(ByteBuf)
constructor instead, to always have header validation enabled.DefaultLastHttpContent(ByteBuf content, HttpHeaders trailingHeaders)
Create a new last HTTP content message with the given contents, and trailing headers.DefaultLastHttpContent(ByteBuf content, HttpHeadersFactory trailersFactory)
Create a new last HTTP content message with the given contents, and trailing headers from the given factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LastHttpContent
copy()
Creates a deep copy of thisByteBufHolder
.LastHttpContent
duplicate()
Duplicates thisByteBufHolder
.LastHttpContent
replace(ByteBuf content)
Returns a newByteBufHolder
which contains the specifiedcontent
.LastHttpContent
retain()
Increases the reference count by1
.LastHttpContent
retain(int increment)
Increases the reference count by the specifiedincrement
.LastHttpContent
retainedDuplicate()
Duplicates thisByteBufHolder
.java.lang.String
toString()
LastHttpContent
touch()
Records the current access location of this object for debugging purposes.LastHttpContent
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.HttpHeaders
trailingHeaders()
-
Methods inherited from class io.netty.handler.codec.http.DefaultHttpContent
content, refCnt, release, release
-
Methods inherited from class io.netty.handler.codec.http.DefaultHttpObject
decoderResult, equals, getDecoderResult, hashCode, setDecoderResult
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.buffer.ByteBufHolder
content
-
Methods inherited from interface io.netty.handler.codec.DecoderResultProvider
decoderResult, setDecoderResult
-
Methods inherited from interface io.netty.handler.codec.http.HttpObject
getDecoderResult
-
Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Constructor Detail
-
DefaultLastHttpContent
public DefaultLastHttpContent()
Create a new empty, last HTTP content message.
-
DefaultLastHttpContent
public DefaultLastHttpContent(ByteBuf content)
Create a new last HTTP content message with the given contents.
-
DefaultLastHttpContent
@Deprecated public DefaultLastHttpContent(ByteBuf content, boolean validateHeaders)
Deprecated.Prefer theDefaultLastHttpContent(ByteBuf)
constructor instead, to always have header validation enabled.Create a new last HTTP content message with the given contents, and optional trailing header validation.Warning! Setting
validateHeaders
tofalse
will mean that Netty won't validate & protect against user-supplied header values that are malicious. This can leave your server implementation vulnerable to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting') . When disabling this validation, it is the responsibility of the caller to ensure that the values supplied do not contain a non-url-escaped carriage return (CR) and/or line feed (LF) characters.
-
DefaultLastHttpContent
public DefaultLastHttpContent(ByteBuf content, HttpHeadersFactory trailersFactory)
Create a new last HTTP content message with the given contents, and trailing headers from the given factory.
-
DefaultLastHttpContent
public DefaultLastHttpContent(ByteBuf content, HttpHeaders trailingHeaders)
Create a new last HTTP content message with the given contents, and trailing headers.
-
-
Method Detail
-
copy
public LastHttpContent copy()
Description copied from interface:ByteBufHolder
Creates a deep copy of thisByteBufHolder
.- Specified by:
copy
in interfaceByteBufHolder
- Specified by:
copy
in interfaceHttpContent
- Specified by:
copy
in interfaceLastHttpContent
- Overrides:
copy
in classDefaultHttpContent
-
duplicate
public LastHttpContent duplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. Be aware that this will not automatically callByteBufHolder.retain()
.- Specified by:
duplicate
in interfaceByteBufHolder
- Specified by:
duplicate
in interfaceHttpContent
- Specified by:
duplicate
in interfaceLastHttpContent
- Overrides:
duplicate
in classDefaultHttpContent
-
retainedDuplicate
public LastHttpContent retainedDuplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. This method returns a retained duplicate unlikeByteBufHolder.duplicate()
.- Specified by:
retainedDuplicate
in interfaceByteBufHolder
- Specified by:
retainedDuplicate
in interfaceHttpContent
- Specified by:
retainedDuplicate
in interfaceLastHttpContent
- Overrides:
retainedDuplicate
in classDefaultHttpContent
- See Also:
ByteBuf.retainedDuplicate()
-
replace
public LastHttpContent replace(ByteBuf content)
Description copied from interface:ByteBufHolder
Returns a newByteBufHolder
which contains the specifiedcontent
.- Specified by:
replace
in interfaceByteBufHolder
- Specified by:
replace
in interfaceHttpContent
- Specified by:
replace
in interfaceLastHttpContent
- Overrides:
replace
in classDefaultHttpContent
-
retain
public LastHttpContent retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttpContent
- Specified by:
retain
in interfaceLastHttpContent
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classDefaultHttpContent
-
retain
public LastHttpContent retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttpContent
- Specified by:
retain
in interfaceLastHttpContent
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classDefaultHttpContent
-
touch
public LastHttpContent touch()
Description copied from interface:ReferenceCounted
Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttpContent
- Specified by:
touch
in interfaceLastHttpContent
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classDefaultHttpContent
-
touch
public LastHttpContent touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttpContent
- Specified by:
touch
in interfaceLastHttpContent
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classDefaultHttpContent
-
trailingHeaders
public HttpHeaders trailingHeaders()
- Specified by:
trailingHeaders
in interfaceLastHttpContent
-
toString
public java.lang.String toString()
- Overrides:
toString
in classDefaultHttpContent
-
-