标签:
// 获取真实IP的方法() public String getIpAddr() { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("CLIENTIP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } // System.out.println(request.getRemoteHost()); return ip; }
来源:http://listen-raining.iteye.com/blog/2168361
标签:
原文地址:http://www.cnblogs.com/davidwang456/p/4180269.html