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.
|
contentLength, contentType, headers, isChunked, isCommitted, isContentBroken, isExpectContent, isSkipRemainder, parsedProtocol, protocolC, 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 |
setContentLengthLong(long contentLength)
Set the content-length of this
HttpPacket. |
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(org.glassfish.grizzly.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, addHeader, addHeader, containsHeader, containsHeader, extractContentEncoding, flushSpecialHeaders, getAttributes, getCharacterEncoding, getContentEncodings, getContentEncodings, getContentLength, getContentType, getContentTypeHolder, getHeader, getHeader, getHeaders, getHttpHeader, getParsingState, getProcessingState, getProtocol, getProtocolDC, getProtocolString, getTempHeaderEncodingBuffer, getTransferEncoding, getUpgrade, getUpgradeDC, httpContentBuilder, httpTrailerBuilder, isChunked, isChunkingAllowed, isCommitted, isContentBroken, isContentEncodingsSelected, isContentTypeSet, isExpectContent, isHeader, isIgnoreContentModifiers, isSecure, isSkipRemainder, isUpgrade, makeContentLengthHeader, makeTransferEncodingHeader, makeUpgradeHeader, recycle, setCharacterEncoding, setChunked, setChunkingAllowed, setCommitted, setContentBroken, setContentEncodingsSelected, setContentLength, setContentType, setContentType, setExpectContent, setHeader, setHeader, setHeader, setHeader, setIgnoreContentModifiers, setProtocol, setSecure, setSkipRemainder, setTransferEncoding, setUpgradeisHttpprotected 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(org.glassfish.grizzly.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 HttpHeaderpublic final boolean isRequest()
isRequest in class HttpHeaderpublic void setLocale(Locale locale)
public String getContentLanguage()
Content-Language response headerpublic void setContentLanguage(String contentLanguage)
Content-Language response header.public void setContentLengthLong(long contentLength)
HttpHeaderHttpPacket. Applicable only in case of fixed-length HTTP message.setContentLengthLong in class HttpHeadercontentLength - the content-length of this HttpPacket. Applicable only in case of fixed-length HTTP
message.public void setRequest(HttpRequestPacket request)
request - the request that triggered this responseCopyright © 2017–2021 Oracle Corporation. All rights reserved.