Package com.oorian
Class RequestParameters
java.lang.Object
com.oorian.RequestParameters
- All Implemented Interfaces:
Serializable
Serializable wrapper for HTTP request parameters.
RequestParameters captures the parameter map from an HttpServletRequest at construction time, allowing the parameters to be accessed after the original request has been completed. This is essential for asynchronous processing and worker thread operations.
Key Features:
- Serializable for session persistence and clustering
- Type-safe accessors for Integer, Long, Float, and Boolean values
- Support for multi-valued parameters
- Default value support for missing parameters
Usage:
RequestParameters params = new RequestParameters(request);
Integer userId = params.getParameterAsInt("userId");
String action = params.getParameter("action", "default");
List<Long> selectedIds = params.getParameterValuesAsLong("ids");
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetParameter(String name) Returns the first value of the specified parameter.getParameter(String name, String defaultValue) Returns the first value of the specified parameter, or a default if not found.final BooleangetParameterAsBoolean(String name) Returns the first value of the specified parameter as a Boolean.final BooleangetParameterAsBoolean(String name, boolean defaultValue) Returns the first value of the specified parameter as a Boolean, or a default.final FloatgetParameterAsFloat(String name) Returns the first value of the specified parameter as a Float.final FloatgetParameterAsFloat(String name, float defaultValue) Returns the first value of the specified parameter as a Float, or a default.final IntegergetParameterAsInt(String name) Returns the first value of the specified parameter as an Integer.final IntegergetParameterAsInt(String name, int defaultValue) Returns the first value of the specified parameter as an Integer, or a default.final LonggetParameterAsLong(String name) Returns the first value of the specified parameter as a Long.final LonggetParameterAsLong(String name, long defaultValue) Returns the first value of the specified parameter as a Long, or a default.String[]Returns an array of all parameter names.String[]getParameterValues(String name) Returns all values for the specified parameter.Returns all values for the specified parameter as a list of Booleans.Returns all values for the specified parameter as a list of Floats.Returns all values for the specified parameter as a list of Integers.Returns all values for the specified parameter as a list of Longs.Returns all values for the specified parameter as a list of Shorts.Returns all values for the specified parameter as a list of Strings.
-
Method Details
-
getParameterNames
Returns an array of all parameter names.- Returns:
- array of parameter names
-
getParameterValues
Returns all values for the specified parameter.- Parameters:
name- the parameter name- Returns:
- array of values, or null if the parameter does not exist
-
getParameter
Returns the first value of the specified parameter.- Parameters:
name- the parameter name- Returns:
- the first value, or null if the parameter does not exist
-
getParameter
Returns the first value of the specified parameter, or a default if not found.- Parameters:
name- the parameter namedefaultValue- the value to return if the parameter does not exist- Returns:
- the parameter value, or the default value
-
getParameterAsInt
Returns the first value of the specified parameter as an Integer.- Parameters:
name- the parameter name- Returns:
- the Integer value, or null if not found or not parseable
-
getParameterAsInt
Returns the first value of the specified parameter as an Integer, or a default.- Parameters:
name- the parameter namedefaultValue- the value to return if the parameter is not found or not parseable- Returns:
- the Integer value, or the default value
-
getParameterAsLong
Returns the first value of the specified parameter as a Long.- Parameters:
name- the parameter name- Returns:
- the Long value, or null if not found or not parseable
-
getParameterAsLong
Returns the first value of the specified parameter as a Long, or a default.- Parameters:
name- the parameter namedefaultValue- the value to return if the parameter is not found or not parseable- Returns:
- the Long value, or the default value
-
getParameterAsFloat
Returns the first value of the specified parameter as a Float.- Parameters:
name- the parameter name- Returns:
- the Float value, or null if not found or not parseable
-
getParameterAsFloat
Returns the first value of the specified parameter as a Float, or a default.- Parameters:
name- the parameter namedefaultValue- the value to return if the parameter is not found or not parseable- Returns:
- the Float value, or the default value
-
getParameterAsBoolean
Returns the first value of the specified parameter as a Boolean.- Parameters:
name- the parameter name- Returns:
- the Boolean value, or null if not found
-
getParameterAsBoolean
Returns the first value of the specified parameter as a Boolean, or a default.- Parameters:
name- the parameter namedefaultValue- the value to return if the parameter is not found- Returns:
- the Boolean value, or the default value
-
getParameterValuesAsString
Returns all values for the specified parameter as a list of Strings.- Parameters:
name- the parameter name- Returns:
- list of String values, or an empty list if not found
-
getParameterValuesAsInt
Returns all values for the specified parameter as a list of Integers.- Parameters:
name- the parameter name- Returns:
- list of Integer values
- Throws:
NumberFormatException- if any value cannot be parsed
-
getParameterValuesAsShort
Returns all values for the specified parameter as a list of Shorts.- Parameters:
name- the parameter name- Returns:
- list of Short values
- Throws:
NumberFormatException- if any value cannot be parsed
-
getParameterValuesAsLong
Returns all values for the specified parameter as a list of Longs.- Parameters:
name- the parameter name- Returns:
- list of Long values
- Throws:
NumberFormatException- if any value cannot be parsed
-
getParameterValuesAsFloat
Returns all values for the specified parameter as a list of Floats.- Parameters:
name- the parameter name- Returns:
- list of Float values
- Throws:
NumberFormatException- if any value cannot be parsed
-
getParameterValuesAsBoolean
Returns all values for the specified parameter as a list of Booleans.- Parameters:
name- the parameter name- Returns:
- list of Boolean values
-