|
||||||||||
| 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
public abstract class HttpHeader
HttpPacket, which represents HTTP message header. There are 2 subtypes
of this class: HttpRequestPacket and HttpResponsePacket.
HttpRequestPacket,
HttpResponsePacket| Nested Class Summary | |
|---|---|
static class |
HttpHeader.Builder<T extends HttpHeader.Builder>
HttpHeader message builder. |
| Field Summary | |
|---|---|
protected String |
characterEncoding
|
protected boolean |
charsetSet
Has the charset been explicitly set. |
protected long |
contentLength
|
protected String |
contentType
|
protected boolean |
contentTypeParsed
|
protected MimeHeaders |
headers
|
protected boolean |
isChunked
|
protected boolean |
isCommitted
|
protected boolean |
isExpectContent
|
protected boolean |
isSkipRemainder
|
protected Protocol |
parsedProtocol
|
protected DataChunk |
protocolC
|
protected String |
quotedCharsetValue
|
protected boolean |
secure
|
protected DataChunk |
upgrade
|
| Constructor Summary | |
|---|---|
HttpHeader()
|
|
| Method Summary | |
|---|---|
protected void |
addContentEncoding(ContentEncoding contentEncoding)
|
void |
addHeader(String name,
String value)
Add the HTTP mime header. |
boolean |
containsHeader(String name)
Returns true, if the mime header with the specific name is present among the HttpHeader mime headers, or false otherwise. |
protected void |
extractContentEncoding(DataChunk value)
Obtain content-encoding value and mark it as serialized. |
protected void |
extractContentType(DataChunk dc)
Obtain content-type value and mark it as serialized. |
AttributeHolder |
getAttributes()
|
String |
getCharacterEncoding()
|
List<ContentEncoding> |
getContentEncodings()
|
protected List<ContentEncoding> |
getContentEncodings(boolean isModifiable)
|
long |
getContentLength()
Get the content-length of this HttpPacket. |
String |
getContentType()
|
protected byte[] |
getDefaultContentType()
|
String |
getHeader(String name)
Get the value, of the specific HTTP mime header. |
MimeHeaders |
getHeaders()
Get all MimeHeaders, associated with the HttpHeader. |
abstract ProcessingState |
getProcessingState()
|
Protocol |
getProtocol()
Get HTTP protocol version. |
DataChunk |
getProtocolDC()
Get the HTTP message protocol version as DataChunk
(avoiding creation of a String object). |
String |
getProtocolString()
Get the HTTP message protocol version. |
TransferEncoding |
getTransferEncoding()
Get the TransferEncoding, responsible for the parsing/serialization of the HTTP message content |
String |
getUpgrade()
|
DataChunk |
getUpgradeDC()
|
HttpContent.Builder |
httpContentBuilder()
Get the HTTP message content builder. |
HttpTrailer.Builder |
httpTrailerBuilder()
Get the HTTP message trailer-chunk builder. |
boolean |
isChunked()
Returns true, if this HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message. |
boolean |
isCommitted()
Is this HttpHeader written? true, if this HttpHeader has been already serialized, and only HttpContent
messages might be serialized for this HttpPacket. |
boolean |
isContentTypeSet()
|
boolean |
isExpectContent()
Returns true, if HTTP message, represented by this header still expects additional content basing either on content-length or chunking information. |
boolean |
isHeader()
Returns true. |
abstract boolean |
isRequest()
Returns true, if the current HttpHeader represent HTTP request message, or false otherwise. |
boolean |
isSecure()
|
boolean |
isSkipRemainder()
Returns true, if either application or HTTP core part is not interested in parsing the rest of this HTTP message content and waits for the next HTTP message to come on this Connection. |
protected void |
makeContentLengthHeader(Connection c,
long defaultLength)
Makes sure content-length header is present. |
protected void |
makeTransferEncodingHeader(String defaultValue)
Makes sure transfer-encoding header is present. |
protected void |
makeUpgradeHeader()
|
void |
recycle()
|
protected void |
reset()
Reset the internal state. |
void |
setCharacterEncoding(String charset)
Set the character encoding of this HTTP message. |
void |
setChunked(boolean isChunked)
Set true, if this HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message. |
void |
setCommitted(boolean isCommitted)
Is this HttpHeader written? true, if this HttpHeader has been already serialized, and only HttpContent
messages might be serialized for this HttpPacket. |
void |
setContentLength(int len)
Set the lenth of this HTTP message. |
void |
setContentLengthLong(long contentLength)
Set the content-length of this HttpPacket. |
void |
setContentType(String type)
Sets the content type. |
protected void |
setDefaultContentType(byte[] defaultContentType)
|
protected void |
setExpectContent(boolean isExpectContent)
|
void |
setHeader(String name,
String value)
Set the value, of the specific HTTP mime header. |
void |
setProtocol(Protocol protocol)
Set the HTTP message protocol version. |
protected void |
setSecure(boolean secure)
Sets the secure status of this HTTP message. |
void |
setSkipRemainder(boolean isSkipRemainder)
Set flag, which is set to true, means that we're not interested in parsing the rest of this HTTP message content and wait for the next HTTP message to come on this Connection. |
protected void |
setTransferEncoding(TransferEncoding transferEncoding)
Set the TransferEncoding, responsible for the parsing/serialization of the HTTP message content. |
void |
setUpgrade(String upgrade)
|
| Methods inherited from class org.glassfish.grizzly.http.HttpPacket |
|---|
isHttp |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean isCommitted
protected final MimeHeaders headers
protected final DataChunk protocolC
protected Protocol parsedProtocol
protected boolean isChunked
protected long contentLength
protected String characterEncoding
protected String quotedCharsetValue
protected boolean charsetSet
protected boolean contentTypeParsed
protected String contentType
protected boolean isExpectContent
protected boolean isSkipRemainder
protected boolean secure
protected final DataChunk upgrade
| Constructor Detail |
|---|
public HttpHeader()
| Method Detail |
|---|
public AttributeHolder getAttributes()
getAttributes in interface AttributeStoragepublic abstract boolean isRequest()
public final boolean isHeader()
isHeader in class HttpPacketpublic abstract ProcessingState getProcessingState()
protected void addContentEncoding(ContentEncoding contentEncoding)
protected List<ContentEncoding> getContentEncodings(boolean isModifiable)
public List<ContentEncoding> getContentEncodings()
public TransferEncoding getTransferEncoding()
TransferEncoding, responsible for the parsing/serialization of the HTTP message content
TransferEncoding, responsible for the parsing/serialization of the HTTP message contentprotected void setTransferEncoding(TransferEncoding transferEncoding)
TransferEncoding, responsible for the parsing/serialization of the HTTP message content.
transferEncoding - the TransferEncoding, responsible for the parsing/serialization of the HTTP message content.public boolean isChunked()
HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message.
HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message.public void setChunked(boolean isChunked)
HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message.
isChunked - true, if this HttpPacket content
will be transferred in chunking mode, or false if case
of fixed-length message.public boolean isExpectContent()
protected void setExpectContent(boolean isExpectContent)
public boolean isSkipRemainder()
Connection.
Otherwise returns false.
Connection.
Otherwise returns false.public void setSkipRemainder(boolean isSkipRemainder)
Connection.
isSkipRemainder - true means that we're not
interested in parsing the rest of this HTTP message content and wait
for the next HTTP message to come on this Connection.public String getUpgrade()
public DataChunk getUpgradeDC()
public void setUpgrade(String upgrade)
protected void makeUpgradeHeader()
protected void makeContentLengthHeader(Connection c,
long defaultLength)
defaultLength - default content-length value.public long getContentLength()
HttpPacket. Applicable only in case
of fixed-length HTTP message.
HttpPacket. Applicable only
in case of fixed-length HTTP message.public void setContentLength(int len)
len - the length of this HTTP message.public void setContentLengthLong(long contentLength)
HttpPacket. Applicable only in case
of fixed-length HTTP message.
contentLength - the content-length of this HttpPacket.
Applicable only in case of fixed-length HTTP message.public boolean isCommitted()
HttpContent
messages might be serialized for this HttpPacket.
HttpContent messages might be serialized
for this HttpPacket.public void setCommitted(boolean isCommitted)
HttpContent
messages might be serialized for this HttpPacket.
isCommitted - true, if this HttpHeader has been
already serialized, and only HttpContent messages might be
serialized for this HttpPacket.protected void makeTransferEncodingHeader(String defaultValue)
defaultValue - default transfer-encoding value.protected void extractContentEncoding(DataChunk value)
value - container for the content-type value.public String getCharacterEncoding()
public void setCharacterEncoding(String charset)
charset - the encoding.protected void extractContentType(DataChunk dc)
dc - container for the content-type value.public boolean isContentTypeSet()
true if a content type has been set.public String getContentType()
public void setContentType(String type)
type - the content typepublic MimeHeaders getHeaders()
MimeHeaders, associated with the HttpHeader.
getHeaders in interface MimeHeadersPacketMimeHeaders, associated with the HttpHeader.public String getHeader(String name)
getHeader in interface MimeHeadersPacketname - the mime header name.
public void setHeader(String name,
String value)
setHeader in interface MimeHeadersPacketname - the mime header name.value - the mime header value.
public void addHeader(String name,
String value)
addHeader in interface MimeHeadersPacketname - the mime header name.value - the mime header value.public boolean containsHeader(String name)
containsHeader in interface MimeHeadersPacketname - the mime header name.
public DataChunk getProtocolDC()
DataChunk
(avoiding creation of a String object). The result format is "HTTP/1.x".
DataChunk
(avoiding creation of a String object). The result format is "HTTP/1.x".public String getProtocolString()
public Protocol getProtocol()
Protocol.public void setProtocol(Protocol protocol)
protocol - Protocolpublic boolean isSecure()
true if this HTTP message is being transmitted
in a secure fashion, otherwise returns false.protected void setSecure(boolean secure)
secure - true if secure, otherwise false.public final HttpContent.Builder httpContentBuilder()
HttpContent.Builder.public HttpTrailer.Builder httpTrailerBuilder()
HttpTrailer.Builder.protected void reset()
public void recycle()
recycle in interface Cacheableprotected byte[] getDefaultContentType()
protected void setDefaultContentType(byte[] defaultContentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||