|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.http.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 MessageByte for Fields - 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_ MessageByte-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 | |
---|---|
MessageBytes |
addValue(byte[] b,
int startN,
int len)
Create a new named header using un-translated byte[]. |
MessageBytes |
addValue(char[] c,
int startN,
int len)
Create a new named header using translated char[]. |
MessageBytes |
addValue(String name)
Create a new named header , return the MessageBytes container for the new value |
void |
clear()
Clears all header fields. |
int |
findHeader(String name,
int starting)
Find the index of a header with the given name. |
String |
getHeader(String name)
|
MessageBytes |
getName(int n)
Returns the Nth header name, or null if there is no such header. |
MessageBytes |
getUniqueValue(String name)
Finds and returns a unique header field with the given name. |
MessageBytes |
getValue(int n)
Returns the Nth header value, or null if there is no such header. |
MessageBytes |
getValue(String name)
Finds and returns a header field 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 |
setLimit(int limit)
Set limit on the number of header fields. |
MessageBytes |
setValue(String name)
Allow "set" operations - return a MessageBytes container for the header value ( existing header or new if this . |
int |
size()
Returns the current number of header fields. |
String |
toString()
EXPENSIVE!!! |
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 setLimit(int limit)
public void recycle()
public void clear()
public String toString()
toString
in class Object
public int size()
public MessageBytes getName(int n)
public MessageBytes getValue(int n)
public int findHeader(String name, int starting)
public Enumeration<String> names()
public Enumeration<String> values(String name)
public MessageBytes addValue(String name)
public MessageBytes addValue(byte[] b, int startN, int len)
public MessageBytes addValue(char[] c, int startN, int len)
public MessageBytes setValue(String name)
public MessageBytes getValue(String name)
public MessageBytes getUniqueValue(String name)
IllegalArgumentException
is thrown.
public String getHeader(String name)
public void removeHeader(String name)
name
- the name of the header field to be removed
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |