code: 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;
      }
docs: Creates a map from the parameters in the specified request. Multi value parameters will be in an array.
  
  @param request the request