以下内容介绍下java获取ip地址的几种思路. 1.直接利用java.net.InetAddress类获取,不过这种方法只在windows环境下有效,在linux环境下只能获取localhost地址(即/etc/hosts文件内容) 代码如下: import java.net.InetAddress; /** * This method works well in windows system. * In Linux system it returns 127.0.0.1 the content…
550 OU-001 Mail rejected by Outlook for policy reasons. If you are not an email/network admin please contact your Email/Internet Service Provider for help. For more information about this block and to request removal please go to: http://www.spamhaus…
方法1 public static String getIp2(HttpServletRequest request) { String ip = request.getHeader("X-Forwarded-For"); if (ip != null && !"unKnown".equalsIgnoreCase(ip)) { // 多次反向代理后会有多个ip值,第一个ip才是真实ip int index = ip.indexOf(",&q…