public abstract class HttpResponsePacket extends HttpHeader
HttpHeader
object, which represents HTTP response message.HttpHeader
,
HttpRequestPacket
Modifier and Type | Class and Description |
---|---|
static class |
HttpResponsePacket.Builder
HttpResponsePacket message builder.
|
Modifier and Type | Field and Description |
---|---|
protected HttpStatus |
httpStatus
Status code.
|
characterEncoding, charsetSet, contentLength, contentType, headers, isChunked, isCommitted, isContentBroken, isExpectContent, isSkipRemainder, parsedProtocol, protocolC, quotedCharsetValue, secure, upgrade
Modifier | Constructor and Description |
---|---|
protected |
HttpResponsePacket() |
Modifier and Type | Method and Description |
---|---|
void |
acknowledged()
Mark this packet as having been acknowledged.
|
static HttpResponsePacket.Builder |
builder(HttpRequestPacket request)
Returns
HttpResponsePacket builder. |
String |
getContentLanguage() |
HttpStatus |
getHttpStatus()
Gets the HTTP status for this response.
|
Locale |
getLocale() |
String |
getReasonPhrase()
Gets the status reason phrase for this response.
|
DataChunk |
getReasonPhraseDC()
Gets the status reason phrase for this response as
DataChunk
(avoid creation of a String object}. |
DataChunk |
getReasonPhraseRawDC()
Gets the custom status reason phrase for this response as
DataChunk
(avoid creation of a String object}. |
HttpRequestPacket |
getRequest() |
int |
getStatus()
Gets the status code for this response.
|
boolean |
isAcknowledgement() |
boolean |
isAllowCustomReasonPhrase()
Returns
true if custom status reason phrases are allowed for
this response, or false otherwise. |
boolean |
isCustomReasonPhraseSet() |
boolean |
isHtmlEncodingCustomReasonPhrase()
Returns if we need to encode HTML sensitive characters in custom reason phrase.
|
boolean |
isRequest()
Returns true, if the current HttpHeader represent
HTTP request message, or false otherwise.
|
protected void |
reset()
Reset the internal state.
|
void |
setAcknowledgement(boolean acknowledgement)
Mark this packet as an acknowledgment to a client expectation.
|
void |
setAllowCustomReasonPhrase(boolean allowCustomReasonPhrase)
Sets if the custom status reason phrases are allowed for
this response.
|
void |
setContentLanguage(String contentLanguage)
Set the value that will be used by the
Content-Language
response header. |
void |
setHtmlEncodingCustomReasonPhrase(boolean isHtmlEncodingCustomReasonPhrase)
Sets if we need to encode HTML sensitive characters in custom reason phrase.
|
void |
setLocale(Locale locale)
Called explicitly by user to set the Content-Language and
the default encoding
|
void |
setReasonPhrase(Buffer reason) |
void |
setReasonPhrase(String message)
Sets the status reason phrase for this response.
|
void |
setRequest(HttpRequestPacket request)
Associates the request that triggered this response.
|
void |
setStatus(HttpStatus status)
Sets the status code for this response.
|
void |
setStatus(int status)
Sets the status code for this response.
|
String |
toString() |
addContentEncoding, addHeader, addHeader, containsHeader, containsHeader, extractContentEncoding, flushSpecialHeaders, getAttributes, getCharacterEncoding, getContentEncodings, getContentEncodings, getContentLength, getContentType, getHeader, getHeader, getHeaders, getHttpHeader, getProcessingState, getProtocol, getProtocolDC, getProtocolString, getTempHeaderEncodingBuffer, getTransferEncoding, getUpgrade, getUpgradeDC, handleGetSpecialHeader, handleGetSpecialHeader, handleSetSpecialHeaders, handleSetSpecialHeaders, httpContentBuilder, httpTrailerBuilder, isChunked, isChunkingAllowed, isCommitted, isContentBroken, isContentEncodingsSelected, isContentTypeSet, isExpectContent, isHeader, isSecure, isSkipRemainder, isSpecialHeader, makeContentLengthHeader, makeTransferEncodingHeader, makeUpgradeHeader, recycle, setCharacterEncoding, setChunked, setChunkingAllowed, setCommitted, setContentBroken, setContentEncodingsSelected, setContentLength, setContentLengthLong, setContentType, setExpectContent, setHeader, setHeader, setProtocol, setSecure, setSkipRemainder, setTransferEncoding, setUpgrade
isHttp
protected HttpStatus httpStatus
public static HttpResponsePacket.Builder builder(HttpRequestPacket request)
HttpResponsePacket
builder.HttpResponsePacket.Builder
.public int getStatus()
public HttpStatus getHttpStatus()
public void setStatus(int status)
status
- the status code for this response.public void setStatus(HttpStatus status)
status
- the status for this response.public final boolean isAllowCustomReasonPhrase()
true
if custom status reason phrases are allowed for
this response, or false otherwise.
true
if custom status reason phrases are allowed for
this response, or false otherwise.
public final void setAllowCustomReasonPhrase(boolean allowCustomReasonPhrase)
allowCustomReasonPhrase
- true
if custom status
reason phrases are allowed for this response, or false otherwise.
public boolean isHtmlEncodingCustomReasonPhrase()
public void setHtmlEncodingCustomReasonPhrase(boolean isHtmlEncodingCustomReasonPhrase)
public final DataChunk getReasonPhraseRawDC()
DataChunk
(avoid creation of a String object}.DataChunk
(avoid creation of a String object}.public final DataChunk getReasonPhraseDC()
DataChunk
(avoid creation of a String object}. This implementation takes into
consideration the isAllowCustomReasonPhrase()
property - if the
custom reason phrase is allowed and it's value is not null - then the
returned result will be equal to getReasonPhraseRawDC()
, otherwise
if custom reason phrase is disallowed or its value is null - the default
reason phrase for the HTTP response getStatus()
will be returned.DataChunk
(avoid creation of a String object}.public final String getReasonPhrase()
public void setReasonPhrase(String message)
message
- the status reason phrase for this response.public void setReasonPhrase(Buffer reason)
public final boolean isCustomReasonPhraseSet()
public HttpRequestPacket getRequest()
public boolean isAcknowledgement()
true
if this response packet is intended
as an acknowledgment to an expectation from a client request.public void setAcknowledgement(boolean acknowledgement)
acknowledgement
- true
if this packet is an
acknowledgment to a client expectation.public void acknowledged()
protected void reset()
reset
in class HttpHeader
public final boolean isRequest()
isRequest
in class HttpHeader
public void setLocale(Locale locale)
public String getContentLanguage()
Content-Language
response headerpublic void setContentLanguage(String contentLanguage)
Content-Language
response header.public void setRequest(HttpRequestPacket request)
request
- the request that triggered this responseCopyright © 2014 Oracle Corporation. All rights reserved.