简体   繁体   English

使用java的用户的ip地址

[英]ip address of user using java

Like to get the IP address and some other details for a web application. 喜欢获取Web应用程序的IP地址和其他一些细节。 eg: location, language, country etc of the user using java. 例如:使用java的用户的位置,语言,国家等。

I found one tool from sourceforge. 我从sourceforge找到了一个工具。 Don't know whether it's good. 不知道这是否好。 java IP Locator java IP定位器

I recommend you try the GeoIP Java API by MaxMind. 我建议您尝试MaxMind的GeoIP Java API It is also used by Shareaza for torrent purposes. 它也被Shareaza用于洪流目的。

If this is for a web application, try using ServletRequest#getRemoteAddr() . 如果这是用于Web应用程序,请尝试使用ServletRequest#getRemoteAddr()

As for the location of the ip address, we're using Maxmind's GeoLite Country . 至于ip地址的位置,我们使用Maxmind的GeoLite Country

The browser language might be read from the request header. 可以从请求标头中读取浏览器语言。

请注意,IP地址可能是代理服务器的IP,而不是请求最终来自的计算机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM