I'm trying to find a way to dynamically add environment parameters to a EJB
call (or dynamically change the the Principal reported in the EJBContext
object).  There does not seem to be a standard way of allowing the client to
substitute out the principal at run time without creating a new context
object.  The below code looks like it should work.  I've tried it on Orion
and the properties always returns empty.  Does jBoss implement this code
differently?  If not, does anyone know of a way to either dynamically add
environment parameters to the context object or programatically set the
principal reported in the EJBContext object?

        <<client>>
        InitialContext ctx = new InitialContext();
        ctx.addToEnvironment(ctx.SECURITY_PRINCIPAL, "NEW_USER_ID");

        <<EJB Bean>>
        String userFromEnv =
sessionContext.getEnvironment().getProperty(Context.SECURITY_PRINCIPAL);

        It makes sense that this should work, but the properties object
returned by getEnvironment() is always empty (in Orion -- have not tried
jBoss yet).



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to