Package io.netty.handler.codec.http
Class DefaultHttpResponse
java.lang.Object
io.netty.handler.codec.http.DefaultHttpObject
io.netty.handler.codec.http.DefaultHttpMessage
io.netty.handler.codec.http.DefaultHttpResponse
- All Implemented Interfaces:
DecoderResultProvider
,HttpMessage
,HttpObject
,HttpResponse
- Direct Known Subclasses:
DefaultFullHttpResponse
The default
HttpResponse
implementation.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpResponse
(HttpVersion version, HttpResponseStatus status) Creates a new instance.DefaultHttpResponse
(HttpVersion version, HttpResponseStatus status, boolean validateHeaders) Deprecated.DefaultHttpResponse
(HttpVersion version, HttpResponseStatus status, boolean validateHeaders, boolean singleFieldHeaders) Deprecated.Use theDefaultHttpResponse(HttpVersion, HttpResponseStatus, HttpHeadersFactory)
constructor instead.DefaultHttpResponse
(HttpVersion version, HttpResponseStatus status, HttpHeaders headers) Creates a new instance.DefaultHttpResponse
(HttpVersion version, HttpResponseStatus status, HttpHeadersFactory headersFactory) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.int
hashCode()
setProtocolVersion
(HttpVersion version) Set the protocol version of thisHttpMessage
setStatus
(HttpResponseStatus status) Set the status of thisHttpResponse
.status()
Returns the status of thisHttpResponse
.toString()
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
-
Field Details
-
status
-
-
Constructor Details
-
DefaultHttpResponse
Creates a new instance.- Parameters:
version
- the HTTP version of this responsestatus
- the status of this response
-
DefaultHttpResponse
@Deprecated public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders) Deprecated.Use theDefaultHttpResponse(HttpVersion, HttpResponseStatus, HttpHeadersFactory)
constructor instead.Creates a new instance.- Parameters:
version
- the HTTP version of this responsestatus
- the status of this responsevalidateHeaders
- validate the header names and values when adding them to theHttpHeaders
-
DefaultHttpResponse
@Deprecated public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status, boolean validateHeaders, boolean singleFieldHeaders) Deprecated.Use theDefaultHttpResponse(HttpVersion, HttpResponseStatus, HttpHeadersFactory)
constructor instead.Creates a new instance.- Parameters:
version
- the HTTP version of this responsestatus
- the status of this responsevalidateHeaders
- validate the header names and values when adding them to theHttpHeaders
singleFieldHeaders
-true
to check and enforce that headers with the same name are appended to the same entry and comma separated. See RFC 7230, 3.2.2.false
to allow multiple header entries with the same name to coexist.
-
DefaultHttpResponse
public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status, HttpHeadersFactory headersFactory) Creates a new instance.- Parameters:
version
- the HTTP version of this responsestatus
- the status of this responseheadersFactory
- theHttpHeadersFactory
used to create the headers for this HTTP Response. The recommended default isDefaultHttpHeadersFactory.headersFactory()
.
-
DefaultHttpResponse
Creates a new instance.- Parameters:
version
- the HTTP version of this responsestatus
- the status of this responseheaders
- the headers for this HTTP Response
-
-
Method Details
-
getStatus
Deprecated.- Specified by:
getStatus
in interfaceHttpResponse
-
status
Description copied from interface:HttpResponse
Returns the status of thisHttpResponse
.- Specified by:
status
in interfaceHttpResponse
- Returns:
- The
HttpResponseStatus
of thisHttpResponse
-
setStatus
Description copied from interface:HttpResponse
Set the status of thisHttpResponse
.- Specified by:
setStatus
in interfaceHttpResponse
-
setProtocolVersion
Description copied from interface:HttpMessage
Set the protocol version of thisHttpMessage
- Specified by:
setProtocolVersion
in interfaceHttpMessage
- Specified by:
setProtocolVersion
in interfaceHttpResponse
- Overrides:
setProtocolVersion
in classDefaultHttpMessage
-
toString
-
hashCode
public int hashCode()- Overrides:
hashCode
in classDefaultHttpMessage
-
equals
- Overrides:
equals
in classDefaultHttpMessage
-
DefaultHttpResponse(HttpVersion, HttpResponseStatus, HttpHeadersFactory)
constructor instead.