aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Container callback restrictions... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Container callback restrictions..." Watch "Container callback restrictions..." New topic
Author

Container callback restrictions...

James Turner
Ranch Hand

Joined: May 10, 2004
Posts: 194
Hi All,

The spec says that in ejbCreate, ejbRemove, ejbActivate and ejbPassivate you can call from the SessionContext the isCallerInRole and getCallerPrincipal but with ejbActivate and ejbPassivate there is no direct caller.

Is this right that calls to isCallerInRole and getCallerPrincipal are allowed in ejbActivate and ejbPassivate?

The spec says so, so it must be, but there is no caller for these methods.

Thanx for any help...

James.


James<br />SCJP 1.4 - 92%<br />SCJD - 93%<br />SCWCD 1.4 - 95%<br />SCBCD 1.3 - 100%<br />SCEA - 92%
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi James,

As per spec:

Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in
the session bean methods for which the Container does not have a client security context.


For a SFSB instance there is a client security context when Container executes ejbActivate/ejbPassivate as stateful session bean is always associated with a particular client since its creation (i.e. since an instance of the bean has been created with the call to ejbCreate method)

Therefore, one can invoke security related methods on SessionContext when Container passivates/activates an instance of SFSB.



Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
James Turner
Ranch Hand

Joined: May 10, 2004
Posts: 194
Hi Alex,

Thank you for your reply, I thought the client security context, like a transaction context was propagated as per call.

Thanx for your help.

James.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Container callback restrictions...