uk.ac.cam.ucs.webauth
Class WebauthRequest

java.lang.Object
  |
  +--uk.ac.cam.ucs.webauth.WebauthRequest
All Implemented Interfaces:
Serializable

public class WebauthRequest
extends Object
implements Serializable

Represents an authentication request message.

Version:
$Revision: 1.5 $ $Date: 2005/07/28 08:33:56 $
See Also:
The Cambridge Web Authentication System: WAA->WLS communication protocol, Serialized Form

Constructor Summary
WebauthRequest()
          Default constructor.
 
Method Summary
 String get(String field)
          Returns a string containing the value of the specified field from this request
 Collection getColl(String field)
          Returns a java.util.Collection containing the comma-seperated strings from the specified field from this request
 long getDate(String field)
          Returns the value of the specified request field as a long value that represents a date.
 Iterator getFieldNames()
          Returns an iterator of all the field names that this request currently contains.
 int getInt(String field)
          Returns an integer value expressing the value of the specified field from this request.
 int length()
          Returns the number of fields found in the request
 void set(String field, Collection value)
          Sets a field in this request to the values from a java.util.Collection
 void set(String field, int value)
          Sets a field in this request to an int value
 void set(String field, long value)
          Sets a field in this request to a long value expressing a date.
 void set(String field, String value)
          Sets a field in this request to a string value
 String toQString()
          Returns this request in the format of a URL query string
 String toString()
          Returns a human-readable representation of this entire request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebauthRequest

public WebauthRequest()
Default constructor. "ver" defaults to 1, "date" to the current date and time.
Method Detail

length

public int length()
Returns the number of fields found in the request
Returns:
the number of fields

getFieldNames

public Iterator getFieldNames()
Returns an iterator of all the field names that this request currently contains.
Returns:
a java.util.Iterator of all the field names

set

public void set(String field,
                String value)
Sets a field in this request to a string value
Parameters:
field - the name of the to set
value - the value

set

public void set(String field,
                int value)
Sets a field in this request to an int value
Parameters:
field - the name of the field to set
value - the value

set

public void set(String field,
                long value)
Sets a field in this request to a long value expressing a date. The date is represented as the number of milliseconds since January 1, 1970 GMT.
Parameters:
field - the name of the field to set
value - the date value

set

public void set(String field,
                Collection value)
Sets a field in this request to the values from a java.util.Collection
Parameters:
field - the name of the field to set
value - the value

get

public String get(String field)
Returns a string containing the value of the specified field from this request
Parameters:
the - field to return
Returns:
the value of the field as a string

getInt

public int getInt(String field)
           throws NumberFormatException
Returns an integer value expressing the value of the specified field from this request.
Parameters:
the - field to return
Returns:
an integer expressing the value of the request field or -1 if the request doesn't have a field of this name or it was empty
Throws:
NumberFormatException - if the field can't be converted into an int

getDate

public long getDate(String field)
             throws ParseException
Returns the value of the specified request field as a long value that represents a date. The date is returned as the number of milliseconds since January 1, 1970 GMT.
Parameters:
the - name of the field to return
Returns:
an integer expressing the value of the specified request field as a long value that represents a date
Throws:
ParseException - if the field can't be converted into an date

getColl

public Collection getColl(String field)
Returns a java.util.Collection containing the comma-seperated strings from the specified field from this request
Parameters:
the - name of the field to return
Returns:
a java.utils.Collection containing the comma-seperated strings from the specified request field. Returns an empty collection if the request doesn't have a field of this name or it was empty

toString

public String toString()
Returns a human-readable representation of this entire request
Overrides:
toString in class Object
Returns:
a string representation of the request

toQString

public String toQString()
Returns this request in the format of a URL query string
Returns:
a string representing the request in URL query format