public class OptLogAspect implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { Map ParameterMap = httpServletRequest.getParameterMap(); Map reqMap = new HashMap(); Set<Map.Entry<String,String[]>> entry = ParameterMap.entrySet(); Iterator<Map.Entry<String,String[]>> it = entry.iterator(); while (it.hasNext()){ Map.Entry<String,String[]> me = it.next(); String key = me.getKey(); String value = me.getValue()[0]; reqMap.put(key,value); } String queryString = JsonUtils.toJson(reqMap); System.out.println(queryString); return true; } @Override public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { } }
get请求和post请求都可以完整获取
原文地址:https://www.cnblogs.com/SimonHu1993/p/11090523.html
时间: 2024-11-13 09:31:26