protected Map<String, String> parseRequest(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); //获取所有的参数名 Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { //得到参数名 String name = paramNames.nextElement(); //通过参数名获取对应的值 String value = request.getParameter(name); map.put(name, value); } return map; }
private Map<String, String> getHeadersInfo() { Map<String, String> map = new HashMap<String, String>(); Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = (String) headerNames.nextElement(); String value = request.getHeader(key); map.put(key, value); } return map; }