Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的应用程序中使用 RESTEasy 服务,现在我不得不获取客户端 IP 地址。所以问题是......我该怎么做?提前致谢
已编辑我刚刚找到了一个带有 servlet 过滤器的解决方案……但仍然……可以在 RESTEasy 服务中完成吗?
您可以像这样在资源中注释上下文:
@GET @Path("/{id}") public Response getMe( final @PathParam("id") String id, @Context HttpServletRequest req) { System.err.println(req.getRemoteAddr());