|
||||||||||
| 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 java.lang.String |
characterEncoding
|
protected boolean |
charsetSet
Has the charset been explicitly set. |
protected long |
contentLength
|
protected java.lang.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 java.lang.String |
quotedCharsetValue
|
protected boolean |
secure
|
protected DataChunk |
upgrade
|
| Constructor Summary | |
|---|---|
HttpHeader()
|
|
| Method Summary | |
|---|---|
protected void |
addContentEncoding(ContentEncoding contentEncoding)
|
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. |
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. |
protected void |
extractContentEncoding(DataChunk value)
Obtain content-encoding value and mark it as serialized. |
AttributeHolder |
getAttributes()
|
java.lang.String |
getCharacterEncoding()
|
java.util.List<ContentEncoding> |
getContentEncodings()
|
protected java.util.List<ContentEncoding> |
getContentEncodings(boolean isModifiable)
|
long |
getContentLength()
Get the content-length of this HttpPacket. |
java.lang.String |
getContentType()
|
protected java.lang.String |
getDefaultContentType()
|
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. |
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). |
java.lang.String |
getProtocolString()
Get the HTTP message protocol version. |
TransferEncoding |
getTransferEncoding()
Get the TransferEncoding, responsible for the parsing/serialization of the HTTP message content |
java.lang.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. |
protected boolean |
isContentEncodingsSelected()
|
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(long defaultLength)
Makes sure content-length header is present. |
protected void |
makeTransferEncodingHeader(java.lang.String defaultValue)
Makes sure transfer-encoding header is present. |
protected void |
makeUpgradeHeader()
|
void |
recycle()
|
protected void |
reset()
Reset the internal state. |
protected Buffer |
serializeContentType(MemoryManager memoryManager,
Buffer buffer)
Serializes Content-Type header into passed Buffer |
void |
setCharacterEncoding(java.lang.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. |
protected void |
setContentEncodingsSelected(boolean isContentEncodingsSelected)
|
void |
setContentLength(int len)
Set the length of this HTTP message. |
void |
setContentLengthLong(long contentLength)
Set the content-length of this HttpPacket. |
void |
setContentType(java.lang.String type)
Sets the content type. |
protected void |
setDefaultContentType(java.lang.String defaultContentType)
|
protected void |
setExpectContent(boolean isExpectContent)
|
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 |
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(java.lang.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 java.lang.String characterEncoding
protected java.lang.String quotedCharsetValue
protected boolean charsetSet
protected boolean contentTypeParsed
protected java.lang.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 java.util.List<ContentEncoding> getContentEncodings(boolean isModifiable)
public java.util.List<ContentEncoding> getContentEncodings()
protected final boolean isContentEncodingsSelected()
protected final void setContentEncodingsSelected(boolean isContentEncodingsSelected)
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 java.lang.String getUpgrade()
public DataChunk getUpgradeDC()
public void setUpgrade(java.lang.String upgrade)
protected void makeUpgradeHeader()
protected void makeContentLengthHeader(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(java.lang.String defaultValue)
defaultValue - default transfer-encoding value.protected void extractContentEncoding(DataChunk value)
value - container for the content-type value.public java.lang.String getCharacterEncoding()
public void setCharacterEncoding(java.lang.String charset)
charset - the encoding.
protected final Buffer serializeContentType(MemoryManager memoryManager,
Buffer buffer)
public boolean isContentTypeSet()
true if a content type has been set.public java.lang.String getContentType()
public void setContentType(java.lang.String type)
type - the content typepublic MimeHeaders getHeaders()
MimeHeaders, associated with the HttpHeader.
getHeaders in interface MimeHeadersPacketMimeHeaders, associated with the HttpHeader.public java.lang.String getHeader(java.lang.String name)
getHeader in interface MimeHeadersPacketname - the mime header name.
public java.lang.String getHeader(Header header)
getHeader in interface MimeHeadersPacketheader - the mime Header
public void setHeader(java.lang.String name,
java.lang.String value)
setHeader in interface MimeHeadersPacketname - the mime header name.value - the mime header value.
public void setHeader(Header header,
java.lang.String value)
setHeader in interface MimeHeadersPacketheader - the mime Header.value - the mime header value.
public void addHeader(java.lang.String name,
java.lang.String value)
addHeader in interface MimeHeadersPacketname - the mime header name.value - the mime header value.
public void addHeader(Header header,
java.lang.String value)
addHeader in interface MimeHeadersPacketheader - the mime Header.value - the mime header value.public boolean containsHeader(java.lang.String name)
containsHeader in interface MimeHeadersPacketname - the mime header name.
public boolean containsHeader(Header header)
Header is present
among the HttpHeader mime headers, otherwise returns false.
containsHeader in interface MimeHeadersPacketheader - the mime Header.
Header is present
among the HttpHeader mime headers, otherwise returns false.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 java.lang.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 java.lang.String getDefaultContentType()
protected void setDefaultContentType(java.lang.String defaultContentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||