休息 - 如何获取呼叫者的IP地址 [英] Rest - how get IP address of caller

查看:168
本文介绍了休息 - 如何获取呼叫者的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Java Rest Web服务并需要调用者的IP地址。我以为我曾经在cookie中看到过这个,但现在我没有看到它。是否有一致的地方可以获得这些信息?

I am writing a Java Rest Web Service and need the caller's IP Address. I thought I saw this in the cookie once but now I don't see it. Is there a consistent place to get this information?

我看到了一个使用OperationalContext来获取它的例子,但这不是在java中。

I saw one example of using an "OperationalContext" to get it but that was not in java.

推荐答案

我认为你可以通过请求对象获取IP。

I think you can get the IP through the request object.

如果我没弄错的话, request.getRemoteAddr()左右。

If I'm not mistaken, request.getRemoteAddr() or so.

这篇关于休息 - 如何获取呼叫者的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆