Playframework 如何在Java Play 1.2.4中获取传入请求IP地址

Playframework 如何在Java Play 1.2.4中获取传入请求IP地址,playframework,playframework-1.x,Playframework,Playframework 1.x,我在游戏中看到了!2.0有Http.Context.current() () 但是在游戏中!1.2.4如何获取当前HTTP请求的IP地址 谢谢。如果您在控制器内,您可以 request.remoteAddress; 否则,您需要这样做 Http.Request.current.get().remoteAddress; 这是正确的,但如果您使用Apache作为前端服务器,则需要查看request.headers.get(“x-forwarded-for”)

我在游戏中看到了!2.0有Http.Context.current() ()

但是在游戏中!1.2.4如何获取当前HTTP请求的IP地址


谢谢。

如果您在控制器内,您可以

request.remoteAddress;
否则,您需要这样做

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

这是正确的,但如果您使用Apache作为前端服务器,则需要查看request.headers.get(“x-forwarded-for”)