|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.util.MimeHeaders
public class MimeHeaders
Memory-efficient repository for Mime Headers. When the object is recycled, it will keep the allocated headers[] and all the MimeHeaderField - no GC is generated. For input headers it is possible to use the BufferChunk for Fileds - so no GC will be generated. The only garbage is generated when using the String for header names/values - this can't be avoided when the servlet calls header methods, but is easy to avoid inside tomcat. The goal is to use _only_ BufferChunk-based Fields, and reduce to 0 the memory overhead of tomcat. TODO: XXX one-buffer parsing - for http ( other protocols don't need that ) XXX remove unused methods XXX External enumerations, with 0 GC. XXX use HeaderName ID
| Field Summary | |
|---|---|
static int |
DEFAULT_HEADER_SIZE
Initial size - should be == average number of headers per request XXX make it configurable ( fine-tuning of web-apps ) |
| Constructor Summary | |
|---|---|
MimeHeaders()
Creates a new MimeHeaders object using a default buffer size. |
|
| Method Summary | |
|---|---|
BufferChunk |
addValue(Buffer buffer,
int startN,
int len)
Create a new named header using un-translated byte[]. |
BufferChunk |
addValue(String name)
Create a new named header , return the MessageBytes container for the new value |
void |
clear()
Clears all header fields. |
boolean |
getAndSetSerialized(int n,
boolean newValue)
Set the header's "serialized" flag and return the prev. |
String |
getHeader(String name)
|
BufferChunk |
getName(int n)
Returns the Nth header name, or null if there is no such header. |
BufferChunk |
getValue(int n)
Returns the Nth header value, or null if there is no such header. |
BufferChunk |
getValue(String name)
Finds and returns a header field with the given name. |
int |
indexOf(String name,
int fromIndex)
Find the index of a header with the given name. |
Enumeration<String> |
names()
Returns an enumeration of strings representing the header field names. |
void |
recycle()
Clears all header fields. |
void |
removeHeader(String name)
Removes a header field with the specified name. |
void |
removeHeader(String name,
String str)
Removes the headers with the given name whose values contain the given string. |
BufferChunk |
setValue(String name)
Allow "set" operations - return a BufferChunk container for the header value ( existing header or new if this . |
int |
size()
Returns the current number of header fields. |
String |
toString()
EXPENSIVE!!! only for debugging. |
Enumeration<String> |
values(String name)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_HEADER_SIZE
| Constructor Detail |
|---|
public MimeHeaders()
| Method Detail |
|---|
public void recycle()
public void clear()
public String toString()
toString in class Objectpublic int size()
public BufferChunk getName(int n)
public BufferChunk getValue(int n)
public boolean getAndSetSerialized(int n,
boolean newValue)
n - the header indexnewValue - the new value
public int indexOf(String name,
int fromIndex)
public Enumeration<String> names()
public Enumeration<String> values(String name)
public BufferChunk addValue(String name)
public BufferChunk addValue(Buffer buffer,
int startN,
int len)
public BufferChunk setValue(String name)
public BufferChunk getValue(String name)
public String getHeader(String name)
public void removeHeader(String name)
name - the name of the header field to be removed
public void removeHeader(String name,
String str)
name - The name of the headers to be removedstr - The string to check the header values against
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||