返回http请求的ip
private String getRemoteIp(HttpServletRequest request) {
String remoteAddr = request.getHeader("X-Forwarded-For");
if (null == remoteAddr || "".equals(remoteAddr)) {
remoteAddr = request.getRemoteAddr();
}
return remoteAddr;
}
网友评论