Ja.NET Standard Edition 5.0

Documentation API Specification

Contents

Header Class Reference

List of all members.


Detailed Description

The general structure for request / response header.

It is essentially constructed by hashtable with key indexed in a vector for position lookup.


Public Member Functions

 Header ()
 A generic header structure.
 Header (Map< String, List< String >> map)
 The alternative constructor which sets the input map as its initial keyTable.
Object clone ()
void add (String key, String value)
 Add a field with the specified value.
void set (String key, String value)
 Set a field with the specified value.
Map< String, List< String > > getFieldMap ()
 Provides an unmodifiable map with all String header names mapped to their String values.
String get (int pos)
 Answers the element at pos, null if no such element exist.
String getKey (int pos)
 Answers the key of this header at pos, null if there are fewer keys in the header.
String get (String key)
 Answers the value corresponding to the specified key.
int length ()
 Answers the number of keys stored in this header.
void setStatusLine (String statusLine)
 Sets the status line in the header request example: GET / HTTP/1.1 response example: HTTP/1.1 200 OK.
String getStatusLine ()
 Gets the status line in the header request example: GET / HTTP/1.1 response example: HTTP/1.1 200 OK.

Private Attributes

ArrayList< String > props
HashMap< String, LinkedList
< String > > 
keyTable
String statusLine

Constructor & Destructor Documentation

Header (  ) 

A generic header structure.

Used mostly for request / response header. The key/value pair of the header may be inserted for later use. The key is stored in an array for indexed slot access.

Header ( Map< String, List< String >>  map  ) 

The alternative constructor which sets the input map as its initial keyTable.

Parameters:
map the initial keyTable as a map


Member Function Documentation

Object clone (  ) 

void add ( String  key,
String  value 
)

Add a field with the specified value.

Parameters:
key 
value 

void set ( String  key,
String  value 
)

Set a field with the specified value.

If the field is not found, it is added. If the field is found, the existing value(s) are overwritten.

Parameters:
key 
value 

Map<String, List<String> > getFieldMap (  ) 

Provides an unmodifiable map with all String header names mapped to their String values.

The map keys are Strings and the values are unmodifiable Lists of Strings.

Returns:
an unmodifiable map of the headers
Since:
1.4

String get ( int  pos  ) 

Answers the element at pos, null if no such element exist.

Returns:
java.lang.String the value of the key
Parameters:
pos int the position to look for

String getKey ( int  pos  ) 

Answers the key of this header at pos, null if there are fewer keys in the header.

Returns:
the key the desired position
Parameters:
pos the position to look for

String get ( String  key  ) 

Answers the value corresponding to the specified key.

Parameters:
key the key to look up.
Returns:
Answers the value for the given key, or null if no such key exists.

int length (  ) 

Answers the number of keys stored in this header.

Returns:
the number of keys.

void setStatusLine ( String  statusLine  ) 

Sets the status line in the header request example: GET / HTTP/1.1 response example: HTTP/1.1 200 OK.

Parameters:
statusLine 

String getStatusLine (  ) 

Gets the status line in the header request example: GET / HTTP/1.1 response example: HTTP/1.1 200 OK.

Returns:
the status line


Member Data Documentation

ArrayList<String> props [private]

HashMap<String, LinkedList<String> > keyTable [private]

String statusLine [private]