• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getCallerPrincipal() in onMessage()

 
Kelly Wood
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On table 12 p344 of the EJB spec, it states that getCallerPrincipal() as one of the methods that can be called within a message listener method (i.e. onMessage()). Does anyone know why it is legal to call getCallerPrincipal, when there is no 'direct' caller for a message driven bean?
 
Kelly Wood
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the notes here: http://www.java.boot.by/bcd-guide/ch10.html#c10s1

"Invoking the getCallerPrincipal() and isCallerInRole(...) methods is DISALLOWED in the message-driven bean methods because the Container DOES NOT HAVE a client security context. The Container MUST throw and log the java.lang.IllegalStateException if either of these methods is invoked."

The above explanation makes sense to me. I am confused as to why the EJB spec states 'getCallerPrincipal()' as one of the methods allowed to be called. I will assume it is an error on the EJB spec. But can someone confirm?
 
Gustavo Dutra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

Please read again the text,

the getCallerPrincipal and isCallerInRole methods are not in the table,

and the specification say that the methods are disallowed to call...

the page is 320.

[ ]s

Gustavo
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic