首页 > 代码库 > java获取客户端IP

java获取客户端IP

public String getRemortIP(HttpServletRequest request) {   if (request.getHeader("x-forwarded-for") == null) {    return request.getRemoteAddr();   }   return request.getHeader("x-forwarded-for");  } 

原文:http://developer.51cto.com/art/201111/305181.htm

java获取客户端IP