如何获得zuul中的请求参数并记录到日志中

目前方法是在zuul中加入前置拦截器,代码如下:
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
Enumeration<String> parameterNames = request.getParameterNames();
log.info("-------------parameterNames-----------------" + parameterNames);
while (parameterNames.hasMoreElements()) {
String paramName = (String) parameterNames.nextElement();
System.out.println("-------------paramName-----------------" + paramName);
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
if (paramValue.length() != 0) {
log.info("参数:" + paramName + "=" + paramValue);
}
}
}
但是并不进while循环
已邀请:

orangewest

赞同来自:

问题已经解决   
解析request.getInputStream(),具体代码见url:
https://gitee.com/orangewest/postCanShuJieXi

要回复问题请先登录注册