|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mortbay.http
Class HttpFields

java.lang.Objectorg.mortbay.http.HttpFields
- public class HttpFields
- extends java.lang.Object
HTTP Fields. A collection of HTTP header and or Trailer fields. This class is not synchronized and needs to be protected from concurrent access. This class is not synchronized as it is expected that modifications will only be performed by a single thread.
- Version:
- $Id: HttpFields.java,v 1.59 2003/11/21 12:11:13 gregwilkins Exp $
| Nested Class Summary | |
class |
HttpFields.Entry
|
private class |
HttpFields.EntryIterator
|
private static class |
HttpFields.Field
|
private static class |
HttpFields.FieldInfo
Private class to hold Field name info |
| Constructor Summary | |
HttpFields()
Constructor. |
|
| Method Summary | |
void |
add(HttpFields fields)
Add fields from another HttpFields instance. |
void |
add(java.lang.String name,
java.lang.String value)
Add to or set a field. |
void |
addDateField(java.lang.String name,
java.util.Date date)
Adds the value of a date field. |
void |
addDateField(java.lang.String name,
long date)
Adds the value of a date field. |
void |
addSetCookie(javax.servlet.http.Cookie cookie,
boolean cookie2)
Format a set cookie value |
void |
clear()
Clear the header. |
boolean |
containsKey(java.lang.String name)
|
void |
destroy()
Destroy the header. |
java.lang.String |
get(java.lang.String name)
|
long |
getDateField(java.lang.String name)
Get a header as a date value. |
(package private) HttpFields.Field |
getField(HttpFields.FieldInfo info,
boolean getValid)
|
(package private) HttpFields.Field |
getField(java.lang.String name)
|
private static HttpFields.FieldInfo |
getFieldInfo(char[] name,
int offset,
int length)
|
private static HttpFields.FieldInfo |
getFieldInfo(java.lang.String name)
|
java.util.Enumeration |
getFieldNames()
Get enumeration of header _names. |
int |
getIntField(java.lang.String name)
Get a header as an integer value. |
static java.lang.Float |
getQuality(java.lang.String value)
|
java.util.Enumeration |
getValues(java.lang.String name)
Get multi headers |
java.util.Enumeration |
getValues(java.lang.String name,
java.lang.String separators)
Get multi field values with separator. |
java.util.Iterator |
iterator()
return an iterator for field name:value pairs |
void |
put(java.lang.String name,
java.util.List list)
Set a field. |
java.lang.String |
put(java.lang.String name,
java.lang.String value)
Set a field. |
void |
putDateField(java.lang.String name,
java.util.Date date)
Sets the value of a date field. |
void |
putDateField(java.lang.String name,
long date)
Sets the value of a date field. |
void |
putIntField(java.lang.String name,
int value)
Sets the value of an integer field. |
static java.util.List |
qualityList(java.util.Enumeration enum)
List values in quality order. |
void |
read(org.mortbay.util.LineInput in)
Read HttpHeaders from inputStream. |
java.lang.String |
remove(java.lang.String name)
Remove a field. |
int |
size()
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
static java.lang.String |
valueParameters(java.lang.String value,
java.util.Map parameters)
Get field value parameters. |
void |
write(java.io.Writer writer)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
log
private static org.apache.commons.logging.Log log
__CacheControl
public static final java.lang.String __CacheControl
- General Fields.
- See Also:
- Constant Field Values
__Connection
public static final java.lang.String __Connection
- General Fields.
- See Also:
- Constant Field Values
__Date
public static final java.lang.String __Date
- General Fields.
- See Also:
- Constant Field Values
__Pragma
public static final java.lang.String __Pragma
- General Fields.
- See Also:
- Constant Field Values
__ProxyConnection
public static final java.lang.String __ProxyConnection
- General Fields.
- See Also:
- Constant Field Values
__Trailer
public static final java.lang.String __Trailer
- General Fields.
- See Also:
- Constant Field Values
__TransferEncoding
public static final java.lang.String __TransferEncoding
- General Fields.
- See Also:
- Constant Field Values
__Upgrade
public static final java.lang.String __Upgrade
- General Fields.
- See Also:
- Constant Field Values
__Via
public static final java.lang.String __Via
- General Fields.
- See Also:
- Constant Field Values
__Warning
public static final java.lang.String __Warning
- General Fields.
- See Also:
- Constant Field Values
__Allow
public static final java.lang.String __Allow
- Entity Fields.
- See Also:
- Constant Field Values
__ContentEncoding
public static final java.lang.String __ContentEncoding
- Entity Fields.
- See Also:
- Constant Field Values
__ContentLanguage
public static final java.lang.String __ContentLanguage
- Entity Fields.
- See Also:
- Constant Field Values
__ContentLength
public static final java.lang.String __ContentLength
- Entity Fields.
- See Also:
- Constant Field Values
__ContentLocation
public static final java.lang.String __ContentLocation
- Entity Fields.
- See Also:
- Constant Field Values
__ContentMD5
public static final java.lang.String __ContentMD5
- Entity Fields.
- See Also:
- Constant Field Values
__ContentRange
public static final java.lang.String __ContentRange
- Entity Fields.
- See Also:
- Constant Field Values
__ContentType
public static final java.lang.String __ContentType
- Entity Fields.
- See Also:
- Constant Field Values
__Expires
public static final java.lang.String __Expires
- Entity Fields.
- See Also:
- Constant Field Values
__LastModified
public static final java.lang.String __LastModified
- Entity Fields.
- See Also:
- Constant Field Values
__Accept
public static final java.lang.String __Accept
- Request Fields.
- See Also:
- Constant Field Values
__AcceptCharset
public static final java.lang.String __AcceptCharset
- Request Fields.
- See Also:
- Constant Field Values
__AcceptEncoding
public static final java.lang.String __AcceptEncoding
- Request Fields.
- See Also:
- Constant Field Values
__AcceptLanguage
public static final java.lang.String __AcceptLanguage
- Request Fields.
- See Also:
- Constant Field Values
__Authorization
public static final java.lang.String __Authorization
- Request Fields.
- See Also:
- Constant Field Values
__Expect
public static final java.lang.String __Expect
- Request Fields.
- See Also:
- Constant Field Values
__Forwarded
public static final java.lang.String __Forwarded
- Request Fields.
- See Also:
- Constant Field Values
__From
public static final java.lang.String __From
- Request Fields.
- See Also:
- Constant Field Values
__Host
public static final java.lang.String __Host
- Request Fields.
- See Also:
- Constant Field Values
__IfMatch
public static final java.lang.String __IfMatch
- Request Fields.
- See Also:
- Constant Field Values
__IfModifiedSince
public static final java.lang.String __IfModifiedSince
- Request Fields.
- See Also:
- Constant Field Values
__IfNoneMatch
public static final java.lang.String __IfNoneMatch
- Request Fields.
- See Also:
- Constant Field Values
__IfRange
public static final java.lang.String __IfRange
- Request Fields.
- See Also:
- Constant Field Values
__IfUnmodifiedSince
public static final java.lang.String __IfUnmodifiedSince
- Request Fields.
- See Also:
- Constant Field Values
__KeepAlive
public static final java.lang.String __KeepAlive
- Request Fields.
- See Also:
- Constant Field Values
__MaxForwards
public static final java.lang.String __MaxForwards
- Request Fields.
- See Also:
- Constant Field Values
__ProxyAuthorization
public static final java.lang.String __ProxyAuthorization
- Request Fields.
- See Also:
- Constant Field Values
__Range
public static final java.lang.String __Range
- Request Fields.
- See Also:
- Constant Field Values
__RequestRange
public static final java.lang.String __RequestRange
- Request Fields.
- See Also:
- Constant Field Values
__Referer
public static final java.lang.String __Referer
- Request Fields.
- See Also:
- Constant Field Values
__TE
public static final java.lang.String __TE
- Request Fields.
- See Also:
- Constant Field Values
__UserAgent
public static final java.lang.String __UserAgent
- Request Fields.
- See Also:
- Constant Field Values
__XForwardedFor
public static final java.lang.String __XForwardedFor
- Request Fields.
- See Also:
- Constant Field Values
__AcceptRanges
public static final java.lang.String __AcceptRanges
- Response Fields.
- See Also:
- Constant Field Values
__Age
public static final java.lang.String __Age
- Response Fields.
- See Also:
- Constant Field Values
__ETag
public static final java.lang.String __ETag
- Response Fields.
- See Also:
- Constant Field Values
__Location
public static final java.lang.String __Location
- Response Fields.
- See Also:
- Constant Field Values
__ProxyAuthenticate
public static final java.lang.String __ProxyAuthenticate
- Response Fields.
- See Also:
- Constant Field Values
__RetryAfter
public static final java.lang.String __RetryAfter
- Response Fields.
- See Also:
- Constant Field Values
__Server
public static final java.lang.String __Server
- Response Fields.
- See Also:
- Constant Field Values
__ServletEngine
public static final java.lang.String __ServletEngine
- Response Fields.
- See Also:
- Constant Field Values
__Vary
public static final java.lang.String __Vary
- Response Fields.
- See Also:
- Constant Field Values
__WwwAuthenticate
public static final java.lang.String __WwwAuthenticate
- Response Fields.
- See Also:
- Constant Field Values
__Cookie
public static final java.lang.String __Cookie
- Other Fields.
- See Also:
- Constant Field Values
__SetCookie
public static final java.lang.String __SetCookie
- Other Fields.
- See Also:
- Constant Field Values
__SetCookie2
public static final java.lang.String __SetCookie2
- Other Fields.
- See Also:
- Constant Field Values
__MimeVersion
public static final java.lang.String __MimeVersion
- Other Fields.
- See Also:
- Constant Field Values
__Identity
public static final java.lang.String __Identity
- Other Fields.
- See Also:
- Constant Field Values
__SoapAction
public static final java.lang.String __SoapAction
- Other Fields.
- See Also:
- Constant Field Values
__info
private static final org.mortbay.util.StringMap __info
__values
private static final org.mortbay.util.StringMap __values
__maxCacheSize
private static final int __maxCacheSize
- See Also:
- Constant Field Values
__Chunked
public static final java.lang.String __Chunked
- Fields Values.
- See Also:
- Constant Field Values
__Close
public static final java.lang.String __Close
- See Also:
- Constant Field Values
__TextHtml
public static final java.lang.String __TextHtml
- See Also:
- Constant Field Values
__MessageHttp
public static final java.lang.String __MessageHttp
- See Also:
- Constant Field Values
__WwwFormUrlEncode
public static final java.lang.String __WwwFormUrlEncode
- See Also:
- Constant Field Values
__ExpectContinue
public static final java.lang.String __ExpectContinue
- See Also:
- Constant Field Values
__separators
public static final java.lang.String __separators
- See Also:
- Constant Field Values
__CRLF
public static final char[] __CRLF
__COLON
public static final char[] __COLON
__dateCache
public static final org.mortbay.util.DateCache __dateCache
__dateSend
public static final java.text.SimpleDateFormat __dateSend
__dateCookie
public static final java.text.SimpleDateFormat __dateCookie
__01Jan1970
public static final java.lang.String __01Jan1970
__dateReceiveFmt
private static final java.lang.String[] __dateReceiveFmt
__dateReceive
public static java.text.SimpleDateFormat[] __dateReceive
__one
private static java.lang.Float __one
__zero
private static java.lang.Float __zero
__qualities
private static org.mortbay.util.StringMap __qualities
_fields
private java.util.ArrayList _fields
_index
private int[] _index
_version
private int _version
| Constructor Detail |
HttpFields
public HttpFields()
- Constructor.
| Method Detail |
getFieldInfo
private static HttpFields.FieldInfo getFieldInfo(java.lang.String name)
getFieldInfo
private static HttpFields.FieldInfo getFieldInfo(char[] name, int offset, int length)
size
public int size()
getFieldNames
public java.util.Enumeration getFieldNames()
- Get enumeration of header _names.
Returns an enumeration of strings representing the header _names
for this request.
getField
HttpFields.Field getField(java.lang.String name)
getField
HttpFields.Field getField(HttpFields.FieldInfo info, boolean getValid)
containsKey
public boolean containsKey(java.lang.String name)
get
public java.lang.String get(java.lang.String name)
getValues
public java.util.Enumeration getValues(java.lang.String name)
- Get multi headers
getValues
public java.util.Enumeration getValues(java.lang.String name, java.lang.String separators)
- Get multi field values with separator.
The multiple values can be represented as separate headers of
the same name, or by a single header using the separator(s), or
a combination of both. Separators may be quoted.
put
public java.lang.String put(java.lang.String name, java.lang.String value)
- Set a field.
put
public void put(java.lang.String name, java.util.List list)
- Set a field.
add
public void add(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
- Add to or set a field.
If the field is allowed to have multiple values, add will add
multiple headers of the same name.
remove
public java.lang.String remove(java.lang.String name)
- Remove a field.
getIntField
public int getIntField(java.lang.String name) throws java.lang.NumberFormatException
- Get a header as an integer value.
Returns the value of an integer field or -1 if not found.
The case of the field name is ignored.
getDateField
public long getDateField(java.lang.String name)
- Get a header as a date value.
Returns the value of a date field, or -1 if not found.
The case of the field name is ignored.
putIntField
public void putIntField(java.lang.String name, int value)
- Sets the value of an integer field.
putDateField
public void putDateField(java.lang.String name, java.util.Date date)
- Sets the value of a date field.
addDateField
public void addDateField(java.lang.String name, java.util.Date date)
- Adds the value of a date field.
addDateField
public void addDateField(java.lang.String name, long date)
- Adds the value of a date field.
putDateField
public void putDateField(java.lang.String name, long date)
- Sets the value of a date field.
read
public void read(org.mortbay.util.LineInput in) throws java.io.IOException
- Read HttpHeaders from inputStream.
write
public void write(java.io.Writer writer) throws java.io.IOException
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
clear
public void clear()
- Clear the header.
destroy
public void destroy()
- Destroy the header.
Help the garbage collector by null everything that we can.
valueParameters
public static java.lang.String valueParameters(java.lang.String value, java.util.Map parameters)
- Get field value parameters.
Some field values can have parameters. This method separates
the value from the parameters and optionally populates a
map with the paramters. For example:
FieldName : Value ; param1=val1 ; param2=val2
getQuality
public static java.lang.Float getQuality(java.lang.String value)
qualityList
public static java.util.List qualityList(java.util.Enumeration enum)
- List values in quality order.
addSetCookie
public void addSetCookie(javax.servlet.http.Cookie cookie, boolean cookie2)
- Format a set cookie value
add
public void add(HttpFields fields)
- Add fields from another HttpFields instance.
Single valued fields are replaced, while all others are added.
iterator
public java.util.Iterator iterator()
- return an iterator for field name:value pairs
|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.mortbay.http.HttpFields