- java.lang.Object
-
- io.netty5.handler.codec.http.DefaultHttpObject
-
- io.netty5.handler.codec.http.DefaultHttpMessage
-
- io.netty5.handler.codec.http.DefaultHttpResponse
-
- io.netty5.handler.codec.http.DefaultFullHttpResponse
-
- All Implemented Interfaces:
DecoderResultProvider
,FullHttpMessage<FullHttpResponse>
,FullHttpResponse
,HttpContent<FullHttpResponse>
,HttpMessage
,HttpObject
,HttpResponse
,LastHttpContent<FullHttpResponse>
,Resource<FullHttpResponse>
,AutoCloseable
public class DefaultFullHttpResponse extends DefaultHttpResponse implements FullHttpResponse
Default implementation of aFullHttpResponse
.
-
-
Constructor Summary
Constructors Constructor Description DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload)
DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, boolean validateHeaders)
DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, boolean validateHeaders, boolean singleFieldHeaders)
DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, HttpHeaders headers, HttpHeaders trailingHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the resource, making it inaccessible.DefaultFullHttpResponse
copy()
Create a copy of this HTTP content instance, and return it.boolean
equals(Object o)
int
hashCode()
boolean
isAccessible()
Check if this object is accessible.Buffer
payload()
Returns theBuffer
representing the payload of the HTTP message.Send<FullHttpResponse>
send()
Send this object instance to another Thread, transferring the ownership to the recipient.FullHttpResponse
setProtocolVersion(HttpVersion version)
Set the protocol version of thisHttpMessage
FullHttpResponse
setStatus(HttpResponseStatus status)
Set the status of thisHttpResponse
.String
toString()
FullHttpResponse
touch(Object hint)
Record the current access location for debugging purposes.HttpHeaders
trailingHeaders()
-
Methods inherited from class io.netty5.handler.codec.http.DefaultHttpResponse
status
-
Methods inherited from class io.netty5.handler.codec.http.DefaultHttpMessage
getProtocolVersion, headers, protocolVersion
-
Methods inherited from class io.netty5.handler.codec.http.DefaultHttpObject
decoderResult, setDecoderResult
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.handler.codec.DecoderResultProvider
decoderResult, setDecoderResult
-
Methods inherited from interface io.netty5.handler.codec.http.HttpMessage
getProtocolVersion, headers, protocolVersion
-
Methods inherited from interface io.netty5.handler.codec.http.HttpResponse
status
-
-
-
-
Constructor Detail
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload)
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, boolean validateHeaders)
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, boolean validateHeaders, boolean singleFieldHeaders)
-
DefaultFullHttpResponse
public DefaultFullHttpResponse(HttpVersion version, HttpResponseStatus status, Buffer payload, HttpHeaders headers, HttpHeaders trailingHeaders)
-
-
Method Detail
-
close
public void close()
Description copied from interface:Resource
Close the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResource<FullHttpResponse>
-
isAccessible
public boolean isAccessible()
Description copied from interface:Resource
Check if this object is accessible.- Specified by:
isAccessible
in interfaceResource<FullHttpResponse>
- Returns:
true
if this object is still valid and can be accessed, otherwisefalse
if, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
touch
public FullHttpResponse touch(Object hint)
Description copied from interface:Resource
Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.- Specified by:
touch
in interfaceResource<FullHttpResponse>
- Parameters:
hint
- An optional hint about this access and its context. May benull
.- Returns:
- This resource instance.
-
payload
public Buffer payload()
Description copied from interface:HttpContent
Returns theBuffer
representing the payload of the HTTP message.- Specified by:
payload
in interfaceHttpContent<FullHttpResponse>
- Returns:
- The
Buffer
representing the payload of the HTTP message.
-
send
public Send<FullHttpResponse> send()
Description copied from interface:Resource
Send this object instance to another Thread, transferring the ownership to the recipient.The object must be in a state where it can be sent, which includes at least being accessible.
When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.
Calling
Resource.close()
on an object that has been sent will have no effect, so this method is safe to call within a try-with-resources statement.- Specified by:
send
in interfaceResource<FullHttpResponse>
-
copy
public DefaultFullHttpResponse copy()
Description copied from interface:HttpContent
Create a copy of this HTTP content instance, and return it.- Specified by:
copy
in interfaceHttpContent<FullHttpResponse>
- Returns:
- A copy of this HTTP content object.
-
trailingHeaders
public HttpHeaders trailingHeaders()
- Specified by:
trailingHeaders
in interfaceLastHttpContent<FullHttpResponse>
-
setProtocolVersion
public FullHttpResponse setProtocolVersion(HttpVersion version)
Description copied from interface:HttpMessage
Set the protocol version of thisHttpMessage
- Specified by:
setProtocolVersion
in interfaceFullHttpResponse
- Specified by:
setProtocolVersion
in interfaceHttpMessage
- Specified by:
setProtocolVersion
in interfaceHttpResponse
- Overrides:
setProtocolVersion
in classDefaultHttpResponse
-
setStatus
public FullHttpResponse setStatus(HttpResponseStatus status)
Description copied from interface:HttpResponse
Set the status of thisHttpResponse
.- Specified by:
setStatus
in interfaceFullHttpResponse
- Specified by:
setStatus
in interfaceHttpResponse
- Overrides:
setStatus
in classDefaultHttpResponse
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classDefaultHttpResponse
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classDefaultHttpResponse
-
toString
public String toString()
- Overrides:
toString
in classDefaultHttpResponse
-
-