HttpSession invocation from EjbContext

Discussions

EJB programming & troubleshooting: HttpSession invocation from EjbContext

  1. HttpSession invocation from EjbContext (2 messages)

    HI ALL

    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.

    Thanks
  2. 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.
  3. 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.Thanks
    if u r using appserver for login...(means u have created users and roles in appserver)
    u can use
    sessionContext.getCallerPrincipal().getName()
    to retrieve the login name

    regards
    joseph