Class 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 name paramName.
      static long getLongParameter​(HttpServletRequest request, java.lang.String paramName, long defaultValue)
      Returns the long parameter with name paramName.
      static java.lang.String getStringParameter​(HttpServletRequest request, java.lang.String paramName, java.lang.String defaultValue)
      Returns the String parameter with name paramName.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RequestHelper

        public RequestHelper()
    • Method Detail

      • getLongParameter

        public static long getLongParameter​(HttpServletRequest request,
                                            java.lang.String paramName,
                                            long defaultValue)
        Returns the long parameter with name paramName. This method returns the defaultValue 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 name paramName. This method returns the defaultValue 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 name paramName. This method returns the defaultValue 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.