[jboss-user] [EJB 3.0] - Re: How to get CallerPrincipal in EJB3 session bean

dkalna do-not-reply at jboss.com
Fri Dec 1 02:02:16 EST 2006


@Stateless
@Local
public class YourBean implements YourInterface {

    @Resource
    SessionContext ctx;

    public void yourMethod() {
        Principal callerPrincipal = ctx.getCallerPrincipal();
    }
}

Basically, you have to use annotations like @javax.annotation.EJB and @javax.annotation.Resource to inject references to Java EE services directly into the fields of your bean.

Regards
Dalibor

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990365#3990365

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990365



More information about the jboss-user mailing list