Home » apache-tomcat-6.0.26-src » org.apache » tomcat » util » http » [javadoc | source]
org.apache.tomcat.util.http
public class: MimeHeaders [javadoc | source]
java.lang.Object
   org.apache.tomcat.util.http.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 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_ 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
public static final  int DEFAULT_HEADER_SIZE    Initial size - should be == average number of headers per request XXX make it configurable ( fine-tuning of web-apps ) 
Constructor:
 public MimeHeaders() 
Method from org.apache.tomcat.util.http.MimeHeaders Summary:
addValue,   addValue,   addValue,   clear,   findHeader,   getHeader,   getName,   getUniqueValue,   getValue,   getValue,   names,   recycle,   removeHeader,   setValue,   size,   toString,   values
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tomcat.util.http.MimeHeaders Detail:
 public MessageBytes addValue(String name) 
    Create a new named header , return the MessageBytes container for the new value
 public MessageBytes addValue(byte[] b,
    int startN,
    int len) 
    Create a new named header using un-translated byte[]. The conversion to chars can be delayed until encoding is known.
 public MessageBytes addValue(char[] c,
    int startN,
    int len) 
    Create a new named header using translated char[].
 public  void clear() 
    Clears all header fields.
 public int findHeader(String name,
    int starting) 
    Find the index of a header with the given name.
 public String getHeader(String name) 
 public MessageBytes getName(int n) 
    Returns the Nth header name, or null if there is no such header. This may be used to iterate through all header fields.
 public MessageBytes getUniqueValue(String name) 
    Finds and returns a unique header field with the given name. If no such field exists, null is returned. If the specified header field is not unique then an IllegalArgumentException is thrown.
 public MessageBytes getValue(int n) 
    Returns the Nth header value, or null if there is no such header. This may be used to iterate through all header fields.
 public MessageBytes getValue(String name) 
    Finds and returns a header field with the given name. If no such field exists, null is returned. If more than one such field is in the header, an arbitrary one is returned.
 public Enumeration names() 
    Returns an enumeration of strings representing the header field names. Field names may appear multiple times in this enumeration, indicating that multiple fields with that name exist in this header.
 public  void recycle() 
    Clears all header fields.
 public  void removeHeader(String name) 
    Removes a header field with the specified name. Does nothing if such a field could not be found.
 public MessageBytes setValue(String name) 
    Allow "set" operations - return a MessageBytes container for the header value ( existing header or new if this .
 public int size() 
    Returns the current number of header fields.
 public String toString() 
    EXPENSIVE!!! only for debugging.
 public Enumeration values(String name)