public static Map < String , Object > createRequestParamsMap ( HttpServletRequest request ) { Map < String , Object > paramsMap = new HashMap <> ( ) ; for ( Enumeration paramNameEnum = request . getParameterNames ( ) ; paramNameEnum . hasMoreElements ( ) ; ) { String paramName = ( String ) paramNameEnum . nextElement ( ) ; String [ ] paramValues = request . getParameterValues ( paramName ) ; if ( paramValues . length == 1 ) { paramsMap . put ( paramName , paramValues [ 0 ] ) ; } else { paramsMap . put ( paramName , paramValues ) ; } } return paramsMap ; }
Creates a map from the parameters in the specified request . Multi value parameters will be in an array .