I see in Play! 2.0 there is Http.Context.current() http://www.playframework.org/documentation/api/2.0/java/play/mvc/Http.Context.html#current()
But in Play! 1.2.4 how would I go about getting the current HTTP request's IP Address?
Thanks.
The simplest way to determine the IP address of a website is to use our DNS Lookup Tool. Simply go to the DNS Lookup Tool, type the website URL into the text entry, and select Lookup. You'll notice the search yielded a list of IPv4 addresses that differ from the IPs shown using the other methods.
Assuming you are making your "web service" with servlets, the rather simple method call . getRemoteAddr() on the request object will give you the callers IP address.
If you are within the controller, you can do
request.remoteAddress;
Otherwise, you would need to do
Http.Request.current.get().remoteAddress;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With