|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.HttpPacket
org.glassfish.grizzly.http.HttpHeader
org.glassfish.grizzly.http.HttpResponsePacket
public abstract class HttpResponsePacket
The HttpHeader object, which represents HTTP response message.
HttpHeader,
HttpRequestPacket| Nested Class Summary | |
|---|---|
static class |
HttpResponsePacket.Builder
HttpResponsePacket message builder. |
| Field Summary | |
|---|---|
protected HttpStatus |
httpStatus
Status code. |
| Fields inherited from class org.glassfish.grizzly.http.HttpHeader |
|---|
characterEncoding, charsetSet, contentLength, contentType, contentTypeParsed, headers, isChunked, isCommitted, isContentBroken, isExpectContent, isSkipRemainder, parsedProtocol, protocolC, quotedCharsetValue, secure, upgrade |
| Constructor Summary | |
|---|---|
protected |
HttpResponsePacket()
|
| Method Summary | |
|---|---|
void |
acknowledged()
Mark this packet as having been acknowledged. |
void |
addHeader(Header header,
String value)
Add the HTTP mime header. |
void |
addHeader(String name,
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(String name)
Returns true, if the mime header with the specific name is present among the HttpHeader mime headers, or false otherwise. |
String |
getContentLanguage()
|
String |
getHeader(Header header)
Get the value, of the specific HTTP mime header. |
String |
getHeader(String name)
Get the value, of the specific HTTP mime header. |
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 |
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(String contentLanguage)
Set the value that will be used by the Content-Language
response header. |
void |
setHeader(Header header,
String value)
Set the value, of the specific HTTP mime header. |
void |
setHeader(String name,
String value)
Set the value, of the specific HTTP mime header. |
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()
|
| Methods inherited from class org.glassfish.grizzly.http.HttpPacket |
|---|
isHttp |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected HttpStatus httpStatus
| Constructor Detail |
|---|
protected HttpResponsePacket()
| Method Detail |
|---|
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.
- Returns:
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 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 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 String toString()
toString in class Objectpublic String getHeader(String name)
HttpHeader
getHeader in interface MimeHeadersPacketgetHeader in class HttpHeadername - the mime header name.
public String getHeader(Header header)
HttpHeader
getHeader in interface MimeHeadersPacketgetHeader in class HttpHeaderheader - the mime Header
public boolean containsHeader(String name)
HttpHeader
containsHeader 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(String name,
String value)
HttpHeader
setHeader in interface MimeHeadersPacketsetHeader in class HttpHeadername - the mime header name.value - the mime header value.
public void setHeader(Header header,
String value)
HttpHeader
setHeader in interface MimeHeadersPacketsetHeader in class HttpHeaderheader - the mime Header.value - the mime header value.
public void addHeader(String name,
String value)
HttpHeader
addHeader in interface MimeHeadersPacketaddHeader in class HttpHeadername - the mime header name.value - the mime header value.
public void addHeader(Header header,
String value)
HttpHeader
addHeader in interface MimeHeadersPacketaddHeader in class HttpHeaderheader - the mime Header.value - the mime header value.public Locale getLocale()
Locale of this response.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 response
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||