request.getRemoteAddr
时间: 2023-09-24 16:08:44 浏览: 125
获取用户真实IP地址,不使用request.getRemoteAddr()的原因是有可能用户使用了代理软件方式避免真实IP地址
request.getRemoteAddr() method returns the IP address of the client who has sent the request to the server. It is a method belonging to the HttpServletRequest class in Java.
For example, if a user is accessing a web application from a computer with IP address 192.168.0.100, then the request.getRemoteAddr() method will return "192.168.0.100".
Note that in some cases, the IP address returned by this method may not be the actual IP address of the client due to network configurations, proxy servers, or other factors.
阅读全文