All Packages Class Hierarchy This Package Previous Next Index
Class w3c.jigsaw.forms.URLDecoder
java.lang.Object
|
+----w3c.jigsaw.forms.URLDecoder
- public class URLDecoder
- extends Object
Form data decoder.
This class takes an InputStream and decodes it in compliance to the
application/x-www-form-urlencoded MIME type.
-
EMPTY_VALUE
-
-
URLDecoder(InputStream)
- Create an URLDecoder for the given stream.
-
URLDecoder(InputStream, boolean)
- Create an URLDecoder for the given stream.
-
addVariable(String, String)
- Define a new variable in this data set.
-
getMultipleValues(String)
- Get the values of the variable, as an array.
-
getValue(String)
- Get the value of a variable.
-
keys()
- Get an enumeration of the variable names.
-
parse()
- Parse our input stream following the
application/x-www-form-urlencoded specification.
EMPTY_VALUE
public static final String EMPTY_VALUE
URLDecoder
public URLDecoder(InputStream in,
boolean overide)
- Create an URLDecoder for the given stream.
- Parameters:
- in - The input stream to be parsed.
- list - Tells how to handle multiple settings of the same variable.
When false, mutiple settings to the same variable
will accumulate the value into an array, returned by getValue().
Otherwise, the last assignment will overide any previous assignment.
URLDecoder
public URLDecoder(InputStream in)
- Create an URLDecoder for the given stream.
Default constructor, which will keep track only of the last setting
of the same variable (if ever it gets assigned multiply).
- Parameters:
- in - The input stream to be parsed.
keys
public Enumeration keys()
- Get an enumeration of the variable names.
- Returns:
- An enumeration continaing one element per key.
addVariable
protected void addVariable(String var,
String val)
- Define a new variable in this data set.
- Parameters:
- name - The name of the variable.
- value - Its value.
getMultipleValues
public String[] getMultipleValues(String name)
- Get the values of the variable, as an array.
Use this method when you have turned off the overide flag
in the constructor of this object. This will always return either an
array of Strings or null.
I use this in the PICS label bureau, and I pretty sure this is not a
good reason to have it here.
- Parameters:
- name - The name of the variable to look for.
- Returns:
- An String[] having one entry per variable's value, or
null if none was found.
getValue
public String getValue(String name)
- Get the value of a variable.
If you have allowed the decoder to accumulate multiple values for the
same variable, this method casts of the value to a String may fail
at runtime.
- Parameters:
- name - The name of the variable whose value is to be fetched.
- Returns:
- Its values, which is always provided as a String, or null.
parse
public Hashtable parse() throws IOException, URLDecoderException
- Parse our input stream following the
application/x-www-form-urlencoded specification.
- Returns:
- The raw bindings obtained from parsing the stream, as a
Hashtable instance.
- Throws: IOException
- When IO error occurs while reading the stream.
- Throws: URLDecoderException
- If the format is invalid.
All Packages Class Hierarchy This Package Previous Next Index