@SuppressWarnings({"rawtypes"})
private void showParams(HttpServletRequest request) {
Map<String, String> params = new HashMap<>();
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
if (paramValues[0].length() != 0) {
params.put(paramName, paramValues[0]);
}
}
}
Map<String, String> heads = new HashMap<>();
Enumeration<String> enumeration = request.getHeaderNames();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
String values = request.getHeader(name);
heads.put(name, values);
}
log.info("request url:" + request.getRequestURL());
log.info("request remoteAddr:" + request.getRemoteAddr());
log.info("request method:" + request.getMethod());
log.info("request header host:" + request.getHeader("Host"));
log.info("request web contextpath:" + request.getContextPath());
log.info("request heads:" + request.getContextPath());
log.info("request queryString:" + request.getQueryString());
log.info("request params:" + JSON.toJSONString(params));
}