EJB programming & troubleshooting: HttpSession invocation from EjbContext
- Posted by: Atanu Pram
- Posted on: March 25 2004 17:48 EST
How to retain the login credentials once logged in to
ejb container from servlet container.To be precise can I invoke the HttpSession/HttpeRequest Objects from a EJB Container.
Assuming everything is all in one server, login credentials (user credentials and permisssions) should propogate automatically from the web layer to the EJB layer.
However, the HttpServletRequest and HttpSession do not propagate. You could, in theory, pass them as method parameters to your EJBs, but this is a really, really bad idea. All this does is tightly tie your EJBs to your web layer, and can break in any number of unpleasant ways.
A much better idea is to retrieve the data from your request and/or session, and pass the data values to your EJBs. The data values (just strings and normal java objects) will be independent of your web layer. This will maintain proper separation between your application layers.
HI ALLHow to retain the login credentials once logged in to ejb container from servlet container.To be precise can I invoke the HttpSession/HttpeRequest Objects from a EJB Container.Thanksif u r using appserver for login...(means u have created users and roles in appserver)
u can use
to retrieve the login name