This content has been marked as final.
Show 2 replies
-
1. Re: How to get the client IP in a EJB when a method is called?
ybxiang.china Jul 30, 2013 3:46 AM (in response to jingjingjiang1986)Maybe it is impossible.
You can get Principle info. from EJBContext.
@Stateless
@Local(ITopicSession.class)
public class TopicSession implements ITopicSession{
@PersistenceContext()
private EntityManager em;
@Resource
private EJBContext ejbContext;
public void doSomething(){
ejbContext.getCallerPrincipal();
}
}
You can inject some context data(for example: IP, session ID) into the EJB Calling on client side and read it on server side.
I discussed it here many months ago.
-
2. Re: How to get the client IP in a EJB when a method is called?
jingjingjiang1986 Jul 30, 2013 12:14 PM (in response to ybxiang.china)if client has two or more network interfaces, ie. there are multiple valid IP. On client side, we do not know which IP is used.