Package io.netty.handler.codec.http
Class DefaultFullHttpResponse
- java.lang.Object
-
- io.netty.handler.codec.http.DefaultHttpObject
-
- io.netty.handler.codec.http.DefaultHttpMessage
-
- io.netty.handler.codec.http.DefaultHttpResponse
-
- io.netty.handler.codec.http.DefaultFullHttpResponse
-
- All Implemented Interfaces:
ByteBufHolder,DecoderResultProvider,FullHttpMessage,FullHttpResponse,HttpContent,HttpMessage,HttpObject,HttpResponse,LastHttpContent,ReferenceCounted
public class DefaultFullHttpResponse extends DefaultHttpResponse implements FullHttpResponse
Default implementation of aFullHttpResponse.
-
-
Field Summary
-
Fields inherited from interface io.netty.handler.codec.http.LastHttpContent
EMPTY_LAST_CONTENT
-
-
Constructor Summary
Constructors Constructor Description DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status)Create an empty HTTP response with the given HTTP version and status.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders)Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders, boolean singleFieldHeaders)Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content)Create an HTTP response with the given HTTP version, status, and contents.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, boolean validateHeaders)Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, boolean validateHeaders, boolean singleFieldHeaders)Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, HttpHeadersFactory headersFactory, HttpHeadersFactory trailersFactory)Create an HTTP response with the given HTTP version, status, contents, and with headers and trailers created by the given header factories.DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, HttpHeaders headers, HttpHeaders trailingHeaders)Create an HTTP response with the given HTTP version, status, contents, headers and trailers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufcontent()Return the data which is held by thisByteBufHolder.FullHttpResponsecopy()Creates a deep copy of thisByteBufHolder.FullHttpResponseduplicate()Duplicates thisByteBufHolder.booleanequals(java.lang.Object o)inthashCode()intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement)Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.FullHttpResponsereplace(ByteBuf content)Returns a newByteBufHolderwhich contains the specifiedcontent.FullHttpResponseretain()Increases the reference count by1.FullHttpResponseretain(int increment)Increases the reference count by the specifiedincrement.FullHttpResponseretainedDuplicate()Duplicates thisByteBufHolder.FullHttpResponsesetProtocolVersion(HttpVersion version)Set the protocol version of thisHttpMessageFullHttpResponsesetStatus(HttpResponseStatus status)Set the status of thisHttpResponse.java.lang.StringtoString()FullHttpResponsetouch()Records the current access location of this object for debugging purposes.FullHttpResponsetouch(java.lang.Object hint)Records the current access location of this object with an additional arbitrary information for debugging purposes.HttpHeaderstrailingHeaders()-
Methods inherited from class io.netty.handler.codec.http.DefaultHttpResponse
getStatus, status
-
Methods inherited from class io.netty.handler.codec.http.DefaultHttpMessage
getProtocolVersion, headers, protocolVersion
-
Methods inherited from class io.netty.handler.codec.http.DefaultHttpObject
decoderResult, getDecoderResult, setDecoderResult
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.handler.codec.DecoderResultProvider
decoderResult, setDecoderResult
-
Methods inherited from interface io.netty.handler.codec.http.HttpMessage
getProtocolVersion, headers, protocolVersion
-
Methods inherited from interface io.netty.handler.codec.http.HttpObject
getDecoderResult
-
Methods inherited from interface io.netty.handler.codec.http.HttpResponse
getStatus, status
-
-
-
-
Constructor Detail
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status)
Create an empty HTTP response with the given HTTP version and status.
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content)
Create an HTTP response with the given HTTP version, status, and contents.
-
DefaultFullHttpResponse
@Deprecated public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders)
Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.Create an empty HTTP response with the given HTTP version, status, and optional header validation.
-
DefaultFullHttpResponse
@Deprecated public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders, boolean singleFieldHeaders)
Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.Create an empty HTTP response with the given HTTP version, status, optional header validation, and optional header combining.
-
DefaultFullHttpResponse
@Deprecated public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, boolean validateHeaders)
Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.Create an HTTP response with the given HTTP version, status, contents, and optional header validation.
-
DefaultFullHttpResponse
@Deprecated public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, boolean validateHeaders, boolean singleFieldHeaders)
Deprecated.Prefer theDefaultFullHttpResponse(HttpVersion, HttpResponseStatus, ByteBuf, HttpHeadersFactory, HttpHeadersFactory)constructor instead.Create an HTTP response with the given HTTP version, status, contents, optional header validation, and optional header combining.
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, HttpHeadersFactory headersFactory, HttpHeadersFactory trailersFactory)
Create an HTTP response with the given HTTP version, status, contents, and with headers and trailers created by the given header factories.The recommended header factory is
DefaultHttpHeadersFactory.headersFactory(), and the recommended trailer factory isDefaultHttpHeadersFactory.trailersFactory().
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, ByteBuf content, HttpHeaders headers, HttpHeaders trailingHeaders)
Create an HTTP response with the given HTTP version, status, contents, headers and trailers.
-
-
Method Detail
-
trailingHeaders
public HttpHeaders trailingHeaders()
- Specified by:
trailingHeadersin interfaceLastHttpContent
-
content
public ByteBuf content()
Description copied from interface:ByteBufHolderReturn the data which is held by thisByteBufHolder.- Specified by:
contentin interfaceByteBufHolder
-
refCnt
public int refCnt()
Description copied from interface:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
retain
public FullHttpResponse retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfaceFullHttpMessage- Specified by:
retainin interfaceFullHttpResponse- Specified by:
retainin interfaceHttpContent- Specified by:
retainin interfaceLastHttpContent- Specified by:
retainin interfaceReferenceCounted
-
retain
public FullHttpResponse retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfaceFullHttpMessage- Specified by:
retainin interfaceFullHttpResponse- Specified by:
retainin interfaceHttpContent- Specified by:
retainin interfaceLastHttpContent- Specified by:
retainin interfaceReferenceCounted
-
touch
public FullHttpResponse touch()
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceByteBufHolder- Specified by:
touchin interfaceFullHttpMessage- Specified by:
touchin interfaceFullHttpResponse- Specified by:
touchin interfaceHttpContent- Specified by:
touchin interfaceLastHttpContent- Specified by:
touchin interfaceReferenceCounted
-
touch
public FullHttpResponse touch(java.lang.Object hint)
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceByteBufHolder- Specified by:
touchin interfaceFullHttpMessage- Specified by:
touchin interfaceFullHttpResponse- Specified by:
touchin interfaceHttpContent- Specified by:
touchin interfaceLastHttpContent- Specified by:
touchin interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
setProtocolVersion
public FullHttpResponse setProtocolVersion(HttpVersion version)
Description copied from interface:HttpMessageSet the protocol version of thisHttpMessage- Specified by:
setProtocolVersionin interfaceFullHttpResponse- Specified by:
setProtocolVersionin interfaceHttpMessage- Specified by:
setProtocolVersionin interfaceHttpResponse- Overrides:
setProtocolVersionin classDefaultHttpResponse
-
setStatus
public FullHttpResponse setStatus(HttpResponseStatus status)
Description copied from interface:HttpResponseSet the status of thisHttpResponse.- Specified by:
setStatusin interfaceFullHttpResponse- Specified by:
setStatusin interfaceHttpResponse- Overrides:
setStatusin classDefaultHttpResponse
-
copy
public FullHttpResponse copy()
Description copied from interface:ByteBufHolderCreates a deep copy of thisByteBufHolder.- Specified by:
copyin interfaceByteBufHolder- Specified by:
copyin interfaceFullHttpMessage- Specified by:
copyin interfaceFullHttpResponse- Specified by:
copyin interfaceHttpContent- Specified by:
copyin interfaceLastHttpContent
-
duplicate
public FullHttpResponse duplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. Be aware that this will not automatically callByteBufHolder.retain().- Specified by:
duplicatein interfaceByteBufHolder- Specified by:
duplicatein interfaceFullHttpMessage- Specified by:
duplicatein interfaceFullHttpResponse- Specified by:
duplicatein interfaceHttpContent- Specified by:
duplicatein interfaceLastHttpContent
-
retainedDuplicate
public FullHttpResponse retainedDuplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. This method returns a retained duplicate unlikeByteBufHolder.duplicate().- Specified by:
retainedDuplicatein interfaceByteBufHolder- Specified by:
retainedDuplicatein interfaceFullHttpMessage- Specified by:
retainedDuplicatein interfaceFullHttpResponse- Specified by:
retainedDuplicatein interfaceHttpContent- Specified by:
retainedDuplicatein interfaceLastHttpContent- See Also:
ByteBuf.retainedDuplicate()
-
replace
public FullHttpResponse replace(ByteBuf content)
Description copied from interface:ByteBufHolderReturns a newByteBufHolderwhich contains the specifiedcontent.- Specified by:
replacein interfaceByteBufHolder- Specified by:
replacein interfaceFullHttpMessage- Specified by:
replacein interfaceFullHttpResponse- Specified by:
replacein interfaceHttpContent- Specified by:
replacein interfaceLastHttpContent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classDefaultHttpResponse
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classDefaultHttpResponse
-
toString
public java.lang.String toString()
- Overrides:
toStringin classDefaultHttpResponse
-
-