Marcus Ericsson
Marcus Ericsson

Reputation: 2049

How do I get incoming request IP address in Java Play 1.2.4

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.

Upvotes: 8

Views: 8101

Answers (1)

Codemwnci
Codemwnci

Reputation: 54884

If you are within the controller, you can do

request.remoteAddress;

Otherwise, you would need to do

Http.Request.current.get().remoteAddress;

Upvotes: 21

Related Questions