Novell exteNd
Director 5.2 API

com.sssw.fw.util
Class EboParameterHolder

java.lang.Object
 |
 +--com.sssw.fw.util.EboParameterHolder

public class EboParameterHolder
extends Object

Form data decoder. This class takes an InputStream and decodes it in compliance to the application/x-www-form-urlencoded MIME type.


Field Summary
static int APPEND
          When merging the contents of two EboParameterHolders this specifies to append the given EboParameterHolder
static int PREPEND
          When merging the contents of two EboParameterHolders this specifies to prepend the given EboParameterHolder
 
Constructor Summary
EboParameterHolder(boolean override, String encoding)
          Alternate constructor allowing specification of an encoding to assume for URL-encoded data
EboParameterHolder(String encoding)
          Alternate constructor allowing specification of an encoding to assume for URL-encoded data.
 
Method Summary
 void addContentsOf(EboParameterHolder paramHolder, int location)
          Merge the contents of another EboParameterHolder into this one If override == false (see addString), any new values are added to the existing ones (and placed by the 'where' argument).
 byte[] getFileContent(String name)
          returns the contents of the file specified by the file name
 String getFileContentType(String name)
          Returns the mime-type of the content of the posted file with the given name
 String[] getMultipleValues(String name)
          Get the values of the variable, as an array.
 String getValue(String name)
          Get the value of a variable.
 Object getValueAsObject(String name)
          Get the value of a variable as an object.
static String getValueFromQueryString(String qStr, String key)
          get the value of one parameter from a query string
 Hashtable getValues()
          Return a clone of the hashtable of all parsed values
static Hashtable getValuesFromQueryString(String qStr)
          get a Hashtable of all values from a query string override is true
 Enumeration keys()
          Get an enumeration of the variable names.
 int numKeys()
          Get an number of variable names found.
 void parseStream(com.sssw.fw.util.EboMimeType type, InputStream in)
          the major public method.
 void parseURLEncodedString(String s)
          Parse an URLEncoded String application/x-www-form-urlencoded specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREPEND

public static final int PREPEND
When merging the contents of two EboParameterHolders this specifies to prepend the given EboParameterHolder
See Also:
EboParameterHolder.addContentsOf(EboParameterHolder,int)

APPEND

public static final int APPEND
When merging the contents of two EboParameterHolders this specifies to append the given EboParameterHolder
See Also:
EboParameterHolder.addContentsOf(EboParameterHolder,int)
Constructor Detail

EboParameterHolder

public EboParameterHolder(String encoding)
Alternate constructor allowing specification of an encoding to assume for URL-encoded data. All Servlet 2.2 and JSP parameter handling is multi-valued. Override will always be false.

EboParameterHolder

public EboParameterHolder(boolean override,
                          String encoding)
Alternate constructor allowing specification of an encoding to assume for URL-encoded data
Method Detail

getValueFromQueryString

public static String getValueFromQueryString(String qStr,
                                             String key)
                                      throws EboURLDecoderException
get the value of one parameter from a query string

getValuesFromQueryString

public static Hashtable getValuesFromQueryString(String qStr)
                                          throws EboURLDecoderException
get a Hashtable of all values from a query string override is true

parseStream

public void parseStream(com.sssw.fw.util.EboMimeType type,
                        InputStream in)
                 throws com.sssw.fw.util.IOException,
                        EboURLDecoderException
the major public method. Add the parameters in the InputStream to our internal Hashtable.

addContentsOf

public void addContentsOf(EboParameterHolder paramHolder,
                          int location)
                   throws EboURLDecoderException
Merge the contents of another EboParameterHolder into this one If override == false (see addString), any new values are added to the existing ones (and placed by the 'where' argument).

keys

public Enumeration keys()
Get an enumeration of the variable names.

numKeys

public int numKeys()
Get an number of variable names found.

getValues

public Hashtable getValues()
Return a clone of the hashtable of all parsed values

getValueAsObject

public Object getValueAsObject(String name)
Get the value of a variable as an object. Optimization used by the Page system. 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, as String[] or null.

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.

getMultipleValues

public String[] getMultipleValues(String name)
Get the values of the variable, as an array. Use this method when you have turned off the override 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.

getFileContentType

public String getFileContentType(String name)
Returns the mime-type of the content of the posted file with the given name
Parameters:
name - the name of the file contained in teh multipart form data
Returns:
the content type of the file contained in the file

getFileContent

public byte[] getFileContent(String name)
returns the contents of the file specified by the file name
Parameters:
name - the name of the file contained in teh multipart form data
Returns:
the contents of the file specified by the file name

parseURLEncodedString

public void parseURLEncodedString(String s)
                           throws EboURLDecoderException
Parse an URLEncoded String application/x-www-form-urlencoded specification.
Throws:
EboURLDecoderException - If the format is invalid.

Novell exteNd
Director 5.2 API