|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.http.HttpFields
public class HttpFields
HTTP Fields. A collection of HTTP header and or Trailer fields.
This class is not synchronized as it is expected that modifications will only be performed by a single thread.
Nested Class Summary | |
---|---|
static class |
HttpFields.Field
|
Field Summary | |
---|---|
static String |
__01Jan1970
|
static Buffer |
__01Jan1970_BUFFER
|
static BufferDateCache |
__dateCache
|
static TimeZone |
__GMT
|
static String |
__separators
|
protected HashMap<Buffer,HttpFields.Field> |
_bufferMap
|
protected ArrayList<HttpFields.Field> |
_fields
|
protected int |
_revision
|
Constructor Summary | |
---|---|
HttpFields()
Constructor. |
Method Summary | |
---|---|
void |
add(Buffer name,
Buffer value)
Add to or set a field. |
void |
add(HttpFields fields)
Add fields from another HttpFields instance. |
void |
add(String name,
String value)
Add to or set a field. |
void |
addDateField(String name,
long date)
Sets the value of a date field. |
void |
addLongField(Buffer name,
long value)
Sets the value of an long field. |
void |
addLongField(String name,
long value)
Sets the value of an long field. |
void |
addSetCookie(HttpCookie cookie)
Format a set cookie value |
void |
addSetCookie(String name,
String value,
String domain,
String path,
long maxAge,
String comment,
boolean isSecure,
boolean isHttpOnly,
int version)
Format a set cookie value |
void |
clear()
Clear the header. |
boolean |
containsKey(Buffer name)
|
boolean |
containsKey(String name)
|
void |
destroy()
Destroy the header. |
static void |
formatCookieDate(StringBuilder buf,
long date)
Format "EEE, dd-MMM-yy HH:mm:ss 'GMT'" for cookies |
static String |
formatDate(long date)
Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" cookies |
Buffer |
get(Buffer name)
|
long |
getDateField(String name)
Get a header as a date value. |
HttpFields.Field |
getField(int i)
Get a Field by index. |
Enumeration<String> |
getFieldNames()
Get enumeration of header _names. |
long |
getLongField(Buffer name)
Get a header as an long value. |
long |
getLongField(String name)
Get a header as an long value. |
static Float |
getQuality(String value)
|
String |
getStringField(Buffer name)
|
String |
getStringField(String name)
|
Enumeration<String> |
getValues(Buffer name)
Get multi headers |
Enumeration<String> |
getValues(String name)
Get multi headers |
Enumeration<String> |
getValues(String name,
String separators)
Get multi field values with separator. |
static long |
parseDate(String date)
|
void |
put(Buffer buffer)
|
void |
put(Buffer name,
Buffer value)
Set a field. |
void |
put(Buffer name,
Buffer value,
long numValue)
Set a field. |
void |
put(Buffer name,
String value)
Set a field. |
void |
put(String name,
List<?> list)
Set a field. |
void |
put(String name,
String value)
Set a field. |
void |
putDateField(Buffer name,
long date)
Sets the value of a date field. |
void |
putDateField(String name,
long date)
Sets the value of a date field. |
void |
putLongField(Buffer name,
long value)
Sets the value of an long field. |
void |
putLongField(String name,
long value)
Sets the value of an long field. |
static List |
qualityList(Enumeration e)
List values in quality order. |
void |
remove(Buffer name)
Remove a field. |
void |
remove(String name)
Remove a field. |
int |
size()
|
String |
toString()
|
static String |
valueParameters(String value,
Map<String,String> parameters)
Get field value parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final TimeZone __GMT
public static final BufferDateCache __dateCache
public static final String __separators
public static final String __01Jan1970
public static final Buffer __01Jan1970_BUFFER
protected final ArrayList<HttpFields.Field> _fields
protected final HashMap<Buffer,HttpFields.Field> _bufferMap
protected int _revision
Constructor Detail |
---|
public HttpFields()
Method Detail |
---|
public static String formatDate(long date)
public static void formatCookieDate(StringBuilder buf, long date)
public static long parseDate(String date)
public Enumeration<String> getFieldNames()
public int size()
public HttpFields.Field getField(int i)
public boolean containsKey(Buffer name)
public boolean containsKey(String name)
public String getStringField(String name)
name
- the case-insensitive field name
public String getStringField(Buffer name)
name
- the case-insensitive field name
public Buffer get(Buffer name)
name
- the case-insensitive field name
public Enumeration<String> getValues(String name)
name
- the case-insensitive field name
public Enumeration<String> getValues(Buffer name)
name
- the case-insensitive field name
public Enumeration<String> getValues(String name, String separators)
name
- the case-insensitive field nameseparators
- String of separators.
public void put(String name, String value)
name
- the name of the fieldvalue
- the value of the field. If null the field is cleared.public void put(Buffer name, String value)
name
- the name of the fieldvalue
- the value of the field. If null the field is cleared.public void put(Buffer name, Buffer value)
name
- the name of the fieldvalue
- the value of the field. If null the field is cleared.public void put(Buffer name, Buffer value, long numValue)
name
- the name of the fieldvalue
- the value of the field. If null the field is cleared.numValue
- the numeric value of the field (must match value) or -1public void put(String name, List<?> list)
name
- the name of the fieldlist
- the List value of the field. If null the field is cleared.public void add(String name, String value) throws IllegalArgumentException
name
- the name of the fieldvalue
- the value of the field.
IllegalArgumentException
- If the name is a single valued field and already has a
value.public void add(Buffer name, Buffer value) throws IllegalArgumentException
name
- the name of the fieldvalue
- the value of the field.
IllegalArgumentException
- If the name is a single valued field and already has a
value.public void remove(String name)
name
- public void remove(Buffer name)
name
- public long getLongField(String name) throws NumberFormatException
name
- the case-insensitive field name
NumberFormatException
- If bad long foundpublic long getLongField(Buffer name) throws NumberFormatException
name
- the case-insensitive field name
NumberFormatException
- If bad long foundpublic long getDateField(String name)
name
- the case-insensitive field namepublic void putLongField(Buffer name, long value)
name
- the field namevalue
- the field long valuepublic void putLongField(String name, long value)
name
- the field namevalue
- the field long valuepublic void addLongField(String name, long value)
name
- the field namevalue
- the field long valuepublic void addLongField(Buffer name, long value)
name
- the field namevalue
- the field long valuepublic void putDateField(Buffer name, long date)
name
- the field namedate
- the field date valuepublic void putDateField(String name, long date)
name
- the field namedate
- the field date valuepublic void addDateField(String name, long date)
name
- the field namedate
- the field date valuepublic void addSetCookie(HttpCookie cookie)
cookie
- The cookie.cookie2
- If true, use the alternate cookie 2 headerpublic void addSetCookie(String name, String value, String domain, String path, long maxAge, String comment, boolean isSecure, boolean isHttpOnly, int version)
cookie
- The cookie.cookie2
- If true, use the alternate cookie 2 headerpublic void put(Buffer buffer) throws IOException
IOException
public String toString()
toString
in class Object
public void clear()
public void destroy()
public void add(HttpFields fields)
fields
- public static String valueParameters(String value, Map<String,String> parameters)
FieldName : Value ; param1=val1 ; param2=val2
value
- The Field value, possibly with parameteres.parameters
- A map to populate with the parameters, or null
public static Float getQuality(String value)
public static List qualityList(Enumeration e)
enum
- Enumeration of values with quality parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |