1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 
<%!
public String getClientIP(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() == 0) {
        ip = request.getRemoteAddr() ;
    }
    
    return ip;
 
}
%>
 
<%=getClientIP(request) %>
cs


'Language > JSP' 카테고리의 다른 글

JSP 국제화 태그  (0) 2015.07.20

+ Recent posts