First you would actually use the home interface to create your UserSession
like so:

Context context = new InitialContext();
Object homeObject = context.lookup("UserSession");
UserSessionHome home =
(UserSessionHome)PortableRemoteObject.narrow(homeObject,
UserSessionHome.class);
UserSession us = (UserSession)
PortableRemoteObject.narrow(home.create(<argumentsGoHere>),
UserSession.class);

Now, you can use your other code to set the values in:

HttpSession sess = request.getSession(true);
sess.putValue("$SESSION$", us);

... later ...

HttpSession sess = request.getSession(true);
UserSession us = (UserSession) sess.get("$SESSION$");

Hope this helps.
-AP_



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Frank Apap
Sent: Saturday, December 25, 1999 12:14 PM
To: Orion-Interest
Subject: Adding a Session bean to an HttpSession


Could someone show me some example code for how to add a session bean to an
HttpSession?  This is the psuedo-code for what i want to do ....

--//UserSession is a Session EJB

UserSession us = new UserSession();
us.setName("MYNAME");
HttpSession sess = request.getSession(true);
sess.add(us);



I know this code is wrong, but I am looking for what the actual code to do
this would be.

Thanks...

Reply via email to