spring-framework / org.springframework.web.bind / ServletRequestUtils / getLongParameter

getLongParameter

@Nullable open static fun getLongParameter(request: ServletRequest, name: String): Long

Get a Long parameter, or null if not present. Throws an exception if it the parameter value isn't a number.

Parameters

request - current HTTP request

name - the name of the parameter

Exceptions

ServletRequestBindingException - a subclass of ServletException, so it doesn't need to be caught

Return
the Long value, or null if not present

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.

Parameters

request - current HTTP request

name - the name of the parameter

defaultVal - the default value to use as fallback