赞
踩
- public String getClientIP() {
-
- HttpServletRequest request = ServletActionContext.getRequest();
-
- String ip = request.getHeader("x-forwarded-for");
- if (null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
- ip = request.getHeader("Proxy-Client-IP");
- }
- if (null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
- ip = request.getHeader("WL-Proxy-Client-IP");
- }
- if (null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
- ip = request.getHeader("X-Real-IP");
- }
- if (null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
- ip = request.getRemoteAddr();
- }
-
- return ip;
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。