You can use EJB 3 interceptors. (EJB3-Core Chapter 12)
Wolfc Thank you.
Now, could you please put some example? or do you have the exact title of the book? thanks.
JSR 220: Enterprise JavaBeans(tm),Version 3.0 Final Release
EJB Core Contracts and Requirements
thank you Wolfc. I´ve mannaged to set up my custom security code as a default interceptor for all my EJB´s.
The problem i´m facing now is that i´m on Jboss 4.0.4GA with ejb3 (RC7?).
It seems that javax.interceptor.InvocationContext Interface doesn´t expose getEJBContext method (It is supposed to be there). I think that RC7 doesnt follow current ejb3 specs?.
There is no getEJBContext in InvocationContext, you either use JNDI lookup of java:comp/EJBContext or injection (in the interceptor class).
RC7 doesn't follow the final EJB3 spec. Upgrade to AS 4.2.0.GA as it is more aligned with the spec.