|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--com.opmath.util.datastruct.OrderedHashtable
|
+--com.opmath.util.datastruct.LCHashtable
|
+--com.opmath.util.http.ParamTable
An object which can provide parameter ((name, value) => index) functions, implemented by extending
com.opmath.util.datastruct.OrderedHashtable.
ParamTable implements the ParamIndex interface using an OrderedHashtable
of (String => OrderedHashtable) mappings. Instances of ParamTable can be
used to keep track of servlet parameter names and values, and help in the control of servlet
doGet(HttpServletRequest, HttpServletResponse)
and doPost(HttpServletRequest, HttpServletResponse) methods.
The class com.opmath.util.http.HttpServlet shows a cononical use of the ParamTable class
and the ParamIndex interface: subclasses of com.opmath.util.http.HttpServlet can make use
of the ParamIndex methods directly, and need not be concerned with the creation or disposal of
the ParamTable instance.
NOTE: com.opmath.util.http.ParamTable requires that the package com.opmath.util.dmldoc
is in place in order to operate.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Inner classes inherited from class java.util.Map |
Map.Entry |
| Field Summary | |
protected static int |
PARAM_INDEX_FAIL
May be returned by getIndex(String, String) and getParamIndex(String, HttpServletRequest). |
| Constructor Summary | |
ParamTable()
Constructs a new ParamTable instance. |
|
| Method Summary | |
int |
getIndex(String paramName,
String paramValue)
Returns the int index associated with the paramName / paramValue pair,
as established by registerIndex(String, String, int). |
int |
getParamIndex(String paramName,
HttpServletRequest req)
Returns the int index of the parameter value found in the HttpServletRequest
whose name is paramName and whose value is found in the HttpServletRequest. |
int |
getValueCount(String paramName)
Returns the number of parameter values registered against paramName. |
Enumeration |
paramIndices(String paramName)
Returns an Enumeration of the parameter indices for the values registered
against paramName. |
Enumeration |
paramMappings()
Returns an Enumeration of the parameter (value => index) mappings known to the registry. |
Enumeration |
paramNames()
Returns an Enumeration of the parameter names known to the registry. |
Enumeration |
paramValues(String paramName)
Returns an Enumeration of the parameter values registered against paramName. |
void |
registerIndex(String paramName,
String paramValue,
int paramValueIndex)
Associates the value of a servlet parameter with an int index. |
| Methods inherited from class com.opmath.util.datastruct.LCHashtable |
normalized |
| Methods inherited from class com.opmath.util.datastruct.OrderedHashtable |
containsKey, elements, get, keys, put, putAll, remove, toString |
| Methods inherited from class java.util.Hashtable |
|
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final int PARAM_INDEX_FAIL
getIndex(String, String) and getParamIndex(String, HttpServletRequest).
getIndex(String, String),
getParamIndex(String, HttpServletRequest)| Constructor Detail |
public ParamTable()
ParamTable instance.
| Method Detail |
public void registerIndex(String paramName,
String paramValue,
int paramValueIndex)
int index.
The main use of the register is to enable switch statements to work over commands handed
to the servlet; to do this, the int must be declared by the servlet as static final.
If the paramName / paramValue pair are already known to the registry, then the previous
index associated with the paramName / paramValue pair is lost.
NOTE 1: Although legal, it would be extremely unwise to register the value
com.opmath.util.http.ParamTable.PARAM_INDEX_FAIL.
NOTE 2: Command parameter value strings are always case-insensitive.
registerIndex in interface ParamIndexparamName - the String name of the parameter.paramValue - the String value of the parameter.paramValueIndex - the int value of the index.the - int value associated with the parameter value.
public int getIndex(String paramName,
String paramValue)
int index associated with the paramName / paramValue pair,
as established by registerIndex(String, String, int).
If the pair paramName / paramValue is not known to the registry,
then getIndex(String, String) will return the int value
com.opmath.util.http.ParamTable.PARAM_INDEX_FAIL.
NOTE: Command parameter value strings are always case-insensitive.
getIndex in interface ParamIndexparamName - the String name of the parameter.paramValue - the String value of the parameter.int value of the parameter, or the int value
com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.
public int getParamIndex(String paramName,
HttpServletRequest req)
int index of the parameter value found in the HttpServletRequest
whose name is paramName and whose value is found in the HttpServletRequest.
If paramName is not found in the HttpServletRequest,
or if the value for paramName found in the HttpServletRequest is not known
to the registry, then getParamIndex(String, HttpServletRequest) will return the
int value com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.
NOTE: Command parameter value strings are always case-insensitive.
getParamIndex in interface ParamIndexparamName - the String name of the parameter.req - the HttpServletRequest containing the parameter.int value of the parameter, or the int value
com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.public int getValueCount(String paramName)
paramName.
If paramName is not known to the registry, then
getValueCount(String) returns the int value 0.
getValueCount in interface ParamIndexparamName - the String name of the parameter.int total number of values held against this name.public Enumeration paramNames()
Enumeration of the parameter names known to the registry. Use the
Enumeration methods on the returned object to fetch the keys sequentially. The enumerated
objects can be cast to String.
paramNames in interface ParamIndexEnumeration of parameter names.public Enumeration paramMappings()
Enumeration of the parameter (value => index) mappings known to the registry.
Use the Enumeration methods on the returned object to fetch the keys sequentially. The
enumerated objects can be cast to com.opmath.util.datastruct.OrderedHashTable.
paramMappings in interface ParamIndexEnumeration of parameter (value => index) mappings.public Enumeration paramValues(String paramName)
Enumeration of the parameter values registered against paramName.
Use the Enumeration methods on the returned object to fetch the keys sequentially. The
enumerated objects can be cast to String.
If paramName is not known to the registry, then paramValues() will return
null.
paramValues in interface ParamIndexparamName - the String name of the parameter.Enumeration of parameter values.public Enumeration paramIndices(String paramName)
Enumeration of the parameter indices for the values registered
against paramName. Use the Enumeration methods on the returned
object to fetch the keys sequentially. The enumerated objects can be cast to Integer.
If paramName is not known to the registry, then paramIndices() will
return null.
paramIndices in interface ParamIndexparamName - the String name of the parameter.Enumeration of parameter names.
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||