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.
|
void |
addHeader(Header header,
java.lang.String value)
Add the HTTP mime header.
|
void |
addHeader(java.lang.String name,
java.lang.String value)
Add the HTTP mime header.
|
static HttpResponsePacket.Builder |
builder(HttpRequestPacket request)
Returns
HttpResponsePacket builder. |
boolean |
containsHeader(Header header)
Returns true, if the mime
Header is present
among the HttpHeader mime headers, otherwise returns false. |
boolean |
containsHeader(java.lang.String name)
Returns true, if the mime header with the specific name is present
among the HttpHeader mime headers, or false otherwise.
|
java.lang.String |
getContentLanguage() |
java.lang.String |
getHeader(Header header)
Get the value, of the specific HTTP mime header.
|
java.lang.String |
getHeader(java.lang.String name)
Get the value, of the specific HTTP mime header.
|
HttpStatus |
getHttpStatus()
Gets the HTTP status for this response.
|
java.util.Locale |
getLocale() |
java.lang.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 |
isChunkingAllowed()
Return
true if chunking is allowed for this response. |
boolean |
isCustomReasonPhraseSet() |
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 |
setChunkingAllowed(boolean chunkingAllowed)
Indicate whether or not chunking may be used by this response.
|
void |
setContentLanguage(java.lang.String contentLanguage)
Set the value that will be used by the
Content-Language
response header. |
void |
setHeader(Header header,
java.lang.String value)
Set the value, of the specific HTTP mime header.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Set the value, of the specific HTTP mime header.
|
void |
setLocale(java.util.Locale locale)
Called explicitly by user to set the Content-Language and
the default encoding
|
void |
setReasonPhrase(Buffer reason) |
void |
setReasonPhrase(java.lang.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.
|
java.lang.String |
toString() |
addContentEncoding, extractContentEncoding, getAttributes, getCharacterEncoding, getContentEncodings, getContentEncodings, getContentLength, getContentType, getHeaders, getProcessingState, getProtocol, getProtocolDC, getProtocolString, getTransferEncoding, getUpgrade, getUpgradeDC, httpContentBuilder, httpTrailerBuilder, isChunked, isCommitted, isContentBroken, isContentEncodingsSelected, isContentTypeSet, isExpectContent, isHeader, isSecure, isSkipRemainder, makeContentLengthHeader, makeTransferEncodingHeader, makeUpgradeHeader, recycle, setCharacterEncoding, setChunked, setCommitted, setContentBroken, setContentEncodingsSelected, setContentLength, setContentLengthLong, setContentType, setExpectContent, 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 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 java.lang.String getReasonPhrase()
public void setReasonPhrase(java.lang.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 boolean isChunkingAllowed()
true if chunking is allowed for this response.true if chunking is allowed for this response.public void setChunkingAllowed(boolean chunkingAllowed)
chunkingAllowed - true if chunked transfer-encoding
is allowed, otherwise returns false.public void acknowledged()
protected void reset()
reset in class HttpHeaderpublic final boolean isRequest()
isRequest in class HttpHeaderpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getHeader(java.lang.String name)
HttpHeadergetHeader in interface MimeHeadersPacketgetHeader in class HttpHeadername - the mime header name.public java.lang.String getHeader(Header header)
HttpHeadergetHeader in interface MimeHeadersPacketgetHeader in class HttpHeaderheader - the mime Headerpublic boolean containsHeader(java.lang.String name)
HttpHeadercontainsHeader in interface MimeHeadersPacketcontainsHeader in class HttpHeadername - the mime header name.public boolean containsHeader(Header header)
HttpHeaderHeader is present
among the HttpHeader mime headers, otherwise returns false.containsHeader in interface MimeHeadersPacketcontainsHeader in class HttpHeaderheader - the mime Header.Header is present
among the HttpHeader mime headers, otherwise returns false.public void setHeader(java.lang.String name,
java.lang.String value)
HttpHeadersetHeader in interface MimeHeadersPacketsetHeader in class HttpHeadername - the mime header name.value - the mime header value.public void setHeader(Header header, java.lang.String value)
HttpHeadersetHeader in interface MimeHeadersPacketsetHeader in class HttpHeaderheader - the mime Header.value - the mime header value.public void addHeader(java.lang.String name,
java.lang.String value)
HttpHeaderaddHeader in interface MimeHeadersPacketaddHeader in class HttpHeadername - the mime header name.value - the mime header value.public void addHeader(Header header, java.lang.String value)
HttpHeaderaddHeader in interface MimeHeadersPacketaddHeader in class HttpHeaderheader - the mime Header.value - the mime header value.public java.util.Locale getLocale()
Locale of this response.public void setLocale(java.util.Locale locale)
public java.lang.String getContentLanguage()
Content-Language
response headerpublic void setContentLanguage(java.lang.String contentLanguage)
Content-Language
response header.public void setRequest(HttpRequestPacket request)
request - the request that triggered this responseCopyright © 2014 Oracle Corporation. All Rights Reserved.