728x90
IP
-
자바로 ip 출력하기개발/개발관련 2019. 11. 26. 11:54
1. 자바로 ip 출력하기 로그인한 사람을 로그로 남기기위해 ip를 저장해야한다. HttpServletRequest를 이용해 ip를 가져올 수 있다. public static String getIpAddr(HttpServletRequest request){ String ip = request.getHeader("X-FORWARDED-FOR"); if (ip == null || ip.length() == 0) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0) { ip = request.getHeader("WL-Proxy-Client-IP"); // 웹로직 } if (ip == null || ip.length(..