Header Ads Widget

Responsive Advertisement

[java] 웹서버에서 client ip 조회, ip 검색 (webserver client ip search)

# 웹 서비스중 요청 클라이언트의 ip 확인 방법( webserver client ip search )

import javax.servlet.http.HttpServletRequest;

public final class CommonUtil {

public static String getIpAddress(HttpServletRequest request) {

String ip = null;
ip = request.getHeader("X-FORWARDED-FOR");
if (ip == null) {
ip = request.getHeader("Proxy-Client-IP");
if (ip == null) {
ip = request.getRemoteAddr();
}
}

return ip;

}
}

댓글 쓰기

0 댓글