如何在EJB3拦截器中获取客户机ip地址? [英] How to get the Client ip address in an EJB3 Interceptor?

查看:146
本文介绍了如何在EJB3拦截器中获取客户机ip地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,出于审计或安全目的,获取进行远程EJB3调用的客户端的IP地址很有用.在EJB3 Bean的上下文中,此信息不容易获得.这是一个可以在JBoss 4.x中实现这一目标的技巧.

Often it's useful for Auditing or security purposes to get the IP Address of the client making a remote EJB3 Call. This information is not readily available in the Context of an EJB3 Bean. Here's a hack to be able to achieve this in JBoss 4.x.

推荐答案

此页面上有答案 https://community.jboss.org/wiki/HowToGetTheClientIpAddressInAnEJB3Interceptor?_sscc=t

基本上,它使用线程名来获取IP地址,因为每个调用都是在其自己的线程中启动的...

Basically it uses the thread name to obtain the ip address as each call is launched in its own thread...

这篇关于如何在EJB3拦截器中获取客户机ip地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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