abstract class ServletRequestUtils
Parameter extraction methods, for an approach distinct from data binding, in which parameters of specific types are required.
This approach is very useful for simple submissions, where binding request parameters to a command object would be overkill.
Author
Juergen Hoeller
Author
Keith Donald
Since
2.0
ServletRequestUtils()
Parameter extraction methods, for an approach distinct from data binding, in which parameters of specific types are required. This approach is very useful for simple submissions, where binding request parameters to a command object would be overkill. |
open static fun getBooleanParameter(request: ServletRequest, name: String): Boolean
Get a Boolean parameter, or Accepts "true", "on", "yes" (any case) and "1" as values for true; treats every other non-empty value as false (i.e. parses leniently). open static fun getBooleanParameter(request: ServletRequest, name: String, defaultVal: Boolean): Boolean
Get a boolean parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied. Accepts "true", "on", "yes" (any case) and "1" as values for true; treats every other non-empty value as false (i.e. parses leniently). |
|
open static fun getBooleanParameters(request: ServletRequest, name: String): BooleanArray
Get an array of boolean parameters, return an empty array if not found. Accepts "true", "on", "yes" (any case) and "1" as values for true; treats every other non-empty value as false (i.e. parses leniently). |
|
open static fun getDoubleParameter(request: ServletRequest, name: String): Double
Get a Double parameter, or open static fun getDoubleParameter(request: ServletRequest, name: String, defaultVal: Double): Double
Get a double parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied. |
|
open static fun getDoubleParameters(request: ServletRequest, name: String): DoubleArray
Get an array of double parameters, return an empty array if not found. |
|
open static fun getFloatParameter(request: ServletRequest, name: String): Float
Get a Float parameter, or open static fun getFloatParameter(request: ServletRequest, name: String, defaultVal: Float): Float
Get a float parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied. |
|
open static fun getFloatParameters(request: ServletRequest, name: String): FloatArray
Get an array of float parameters, return an empty array if not found. |
|
open static fun getIntParameter(request: ServletRequest, name: String): Int
Get an Integer parameter, or open static fun getIntParameter(request: ServletRequest, name: String, defaultVal: Int): Int
Get an int parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied. |
|
open static fun getIntParameters(request: ServletRequest, name: String): IntArray
Get an array of int parameters, return an empty array if not found. |
|
open static fun getLongParameter(request: ServletRequest, name: String): Long
Get a Long parameter, or open static fun getLongParameter(request: ServletRequest, name: String, defaultVal: Long): Long
Get a long parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied. |
|
open static fun getLongParameters(request: ServletRequest, name: String): LongArray
Get an array of long parameters, return an empty array if not found. |
|
open static fun getRequiredBooleanParameter(request: ServletRequest, name: String): Boolean
Get a boolean parameter, throwing an exception if it isn't found or isn't a boolean. Accepts "true", "on", "yes" (any case) and "1" as values for true; treats every other non-empty value as false (i.e. parses leniently). |
|
open static fun getRequiredBooleanParameters(request: ServletRequest, name: String): BooleanArray
Get an array of boolean parameters, throwing an exception if not found or one isn't a boolean. Accepts "true", "on", "yes" (any case) and "1" as values for true; treats every other non-empty value as false (i.e. parses leniently). |
|
open static fun getRequiredDoubleParameter(request: ServletRequest, name: String): Double
Get a double parameter, throwing an exception if it isn't found or isn't a number. |
|
open static fun getRequiredDoubleParameters(request: ServletRequest, name: String): DoubleArray
Get an array of double parameters, throwing an exception if not found or one is not a number. |
|
open static fun getRequiredFloatParameter(request: ServletRequest, name: String): Float
Get a float parameter, throwing an exception if it isn't found or isn't a number. |
|
open static fun getRequiredFloatParameters(request: ServletRequest, name: String): FloatArray
Get an array of float parameters, throwing an exception if not found or one is not a number. |
|
open static fun getRequiredIntParameter(request: ServletRequest, name: String): Int
Get an int parameter, throwing an exception if it isn't found or isn't a number. |
|
open static fun getRequiredIntParameters(request: ServletRequest, name: String): IntArray
Get an array of int parameters, throwing an exception if not found or one is not a number.. |
|
open static fun getRequiredLongParameter(request: ServletRequest, name: String): Long
Get a long parameter, throwing an exception if it isn't found or isn't a number. |
|
open static fun getRequiredLongParameters(request: ServletRequest, name: String): LongArray
Get an array of long parameters, throwing an exception if not found or one is not a number. |
|
open static fun getRequiredStringParameter(request: ServletRequest, name: String): String
Get a String parameter, throwing an exception if it isn't found. |
|
open static fun getRequiredStringParameters(request: ServletRequest, name: String): Array<String>
Get an array of String parameters, throwing an exception if not found. |
|
open static fun getStringParameter(request: ServletRequest, name: String): String
Get a String parameter, or open static fun getStringParameter(request: ServletRequest, name: String, defaultVal: String): String
Get a String parameter, with a fallback value. Never throws an exception. Can pass a distinguished value to default to enable checks of whether it was supplied. |
|
open static fun getStringParameters(request: ServletRequest, name: String): Array<String>
Get an array of String parameters, return an empty array if not found. |