Package com.day.cq.statistics.util
Class RequestHelper
- java.lang.Object
-
- com.day.cq.statistics.util.RequestHelper
-
public class RequestHelper extends java.lang.Object
RequestHelper
provides utility methods for request handling.
-
-
Constructor Summary
Constructors Constructor Description RequestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getDateParameter(HttpServletRequest request, java.lang.String paramName, long defaultValue)
Returns the date parameter with nameparamName
.static long
getLongParameter(HttpServletRequest request, java.lang.String paramName, long defaultValue)
Returns the long parameter with nameparamName
.static java.lang.String
getStringParameter(HttpServletRequest request, java.lang.String paramName, java.lang.String defaultValue)
Returns the String parameter with nameparamName
.
-
-
-
Method Detail
-
getLongParameter
public static long getLongParameter(HttpServletRequest request, java.lang.String paramName, long defaultValue)
Returns the long parameter with nameparamName
. This method returns thedefaultValue
if the parameter value is malformed or missing.- Parameters:
request
- the request.paramName
- the parameter name.defaultValue
- a default value.- Returns:
- the parameter value as a long or the default if missing or malformed.
-
getDateParameter
public static long getDateParameter(HttpServletRequest request, java.lang.String paramName, long defaultValue)
Returns the date parameter with nameparamName
. This method returns thedefaultValue
if the parameter value is malformed or missing. The expected date pattern is: 'yyyyMMdd'.- Parameters:
request
- the request.paramName
- the parameter name.defaultValue
- a default value.- Returns:
- the parameter value as a long date or the default if missing or malformed.
-
getStringParameter
public static java.lang.String getStringParameter(HttpServletRequest request, java.lang.String paramName, java.lang.String defaultValue)
Returns the String parameter with nameparamName
. This method returns thedefaultValue
if the parameter value is missing.- Parameters:
request
- the request.paramName
- the parameter name.defaultValue
- a default value.- Returns:
- the parameter value or the default if missing.
-
-