@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
StringBuffer buf = new StringBuffer();
buf.append("URL=:" + request.getRequestURL() + "\r\n");
Enumeration<String> names = request.getParameterNames();
int c = 0;
while (names.hasMoreElements()) {
c++;
String key = names.nextElement();
String value = request.getParameter(key);
buf.append(String.format("%s --> %s \r\n", key, value));
}
buf.append("Parameter Length " + c + "\r\n");
String userAgent = request.getHeader("User-Agent");
buf.append("is from phone ? " + (userAgent.contains("Android") ? "Android" : "") + (userAgent.contains("iPhone") ? "iOS" : ""));
System.out.println(buf);
return true;
}