日期:2014-05-17 浏览次数:20770 次
/**
*
*/
package com.ccit.ejtg.util;
import javax.servlet.http.HttpServletRequest;
/**
* @描述 获得IP4
* @author XYY
* @time 2010-3-22上午09:06:14
* @version 1.0
* @类名 IP4.java
*/
public class IP4 {
public static String getIP4(HttpServletRequest request){
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.getRemoteAddr();
}
return ip;
}
}