获取request里面所有的Parameter所有的请求参数

public static Map<String,Object> showParams(HttpServletRequest request) {  
            Map<String,Object> map = new HashMap<String,Object>();  
            Enumeration paramNames = request.getParameterNames();  
            while (paramNames.hasMoreElements()) {  
                String paramName = (String) paramNames.nextElement();  

                String[] paramValues = request.getParameterValues(paramName);  
                if (paramValues.length >0) {  
                    String paramValue = paramValues[0];  
                    if (paramValue.length() != 0) {  
                        map.put(paramName, paramValue);  
                    }  
                }  
            }  

            SetString, Object>> set = map.entrySet();  
            logger.debug("==============================================================");  
            for (Map.Entry entry : set) {  
                logger.debug(entry.getKey() + ":" + entry.getValue());  
            }  
            logger.debug("=============================================================");  
            return map;
        }

你可能感兴趣的:(随笔)