输出HttpServletRequest中head、param全部参数
public void printRequest(HttpServletRequest request){
Enumeration<String> headerNames = request.getHeaderNames();
Map<String, String> headerMap = new HashMap<>();
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
headerMap.put(name, request.getHeader(name));
}
log.info("HttpServletRequest headerMap:{}", JSON.toJSONString(headerMap));
Enumeration<String> parames = request.getParameterNames();
Map<String, String> paramMap = new LinkedHashMap<>();
while (parames.hasMoreElements()) {
String name = parames.nextElement();
paramMap.put(name, request.getParameter(name));
}
log.info("HttpServletRequest paramMap:{}", paramMap);
}