|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 |
charEncoding
|
protected boolean |
charEncodingParsed
|
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 BufferChunk |
protocolBC
|
protected boolean |
secure
|
protected BufferChunk |
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(BufferChunk value)
Obtain content-encoding value and mark it as serialized. |
protected void |
extractContentType(BufferChunk bc)
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()
|
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. |
BufferChunk |
getProtocolBC()
Get the HTTP message protocol version as BufferChunk
(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()
|
BufferChunk |
getUpgradeBC()
|
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 |
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(String defaultValue)
Makes sure transfer-encoding header is present. |
protected void |
makeUpgradeHeader()
|
void |
recycle()
|
protected void |
reset()
Reset the internal state. |
void |
setCharacterEncoding(String enc)
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 isCommited)
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 |
setContentLength(long contentLength)
Set the content-length of this HttpPacket. |
void |
setContentType(String type)
Set the content type of this HTTP message. |
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 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 BufferChunk protocolBC
protected Protocol parsedProtocol
protected boolean isChunked
protected long contentLength
protected String charEncoding
protected boolean charEncodingParsed
protected boolean contentTypeParsed
protected String contentType
protected boolean isExpectContent
protected boolean isSkipRemainder
protected boolean secure
protected final BufferChunk upgrade
| Constructor Detail |
|---|
public HttpHeader()
| Method Detail |
|---|
public AttributeHolder getAttributes()
getAttributes in interface AttributeStoragepublic abstract boolean isRequest()
public final boolean isHeader()
isHeader in interface 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 BufferChunk getUpgradeBC()
public void setUpgrade(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 setContentLength(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 isCommited)
HttpContent
messages might be serialized for this HttpPacket.
isCommited - 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(BufferChunk value)
value - container for the content-type value.public String getCharacterEncoding()
public void setCharacterEncoding(String enc)
enc - the encoding.protected void extractContentType(BufferChunk bc)
bc - container for the content-type value.public String getContentType()
public void setContentType(String type)
type - the content type.public 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 BufferChunk getProtocolBC()
BufferChunk
(avoiding creation of a String object). The result format is "HTTP/1.x".
BufferChunk
(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 Cacheable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||