2015-02-26 12:48

[Java] 取得 Client IP

public String getClientIp(HttpServletRequest request){
    String ip = request.getHeader("X-FORWARDED-FOR");

    if (ip == null) {
        ip = request.getRemoteAddr();
    }

    return ip;
}

0 回應: