记录 CXF 中解析的主机名

发布于 2024-09-05 20:58:39 字数 151 浏览 0 评论 0原文

我有一个使用 CXF 的 java Web 服务客户端。服务器有 10 多个可能的 ip,通过动态 dns 解析。我已正确配置 jvm,不缓存 dns。

我的问题是,我需要使用有效负载传送到的 IP 登录客户端。仅记录主机名是行不通的,因为主机名到 IP 的解析不断变化。

I have a java web service client that uses CXF. The server has 10+ possible ips that are resolved via dynamic dns. I have the jvm configured properly to not cache dns.

My question is, I have the requirement that I need to log on the client the payload with the ip it was delivered to. Logging just the hostname will not work as the hostname to ip resolution is constantly changing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜你已久 2024-09-12 20:58:39

我建议从以下位置获取 CXF LoggingInInterceptor 的源代码:
http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java

并将其更新为套件您的需求。特别是,您需要从消息中获取 HttpServletREquest,并弄清楚如何从中获取 IP 以添加到日志中。 CXF 版本与协议无关(适用于 JMS 或其他协议),因此不会执行任何需要 HttpServletRequest 的 HTTP 特定操作。

I would suggest grabbing the source of the CXF LoggingInInterceptor from:
http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java

and update it to suite your needs. Particularly, you would need to grab the HttpServletREquest off the message and figure out how to get the IP off of it to add to the logs. The CXF version is protocol agnostic (would work for JMS or others) and thus doesn't do any of the HTTP specific things that would require the HttpServletRequest.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文