how to pass some data from client to EJB? - Weblogic

This is a discussion on how to pass some data from client to EJB? - Weblogic ; In my application,when user login system,the user_id is put into HttpSession. Every time when user access the servlet,we first get the user_id from HttpSession and store the user_id in Thread Context (use ThreadLocal Object),then other java object invoke by the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: how to pass some data from client to EJB?

  1. how to pass some data from client to EJB?


    In my application,when user login system,the user_id is put into HttpSession.
    Every time when user access the servlet,we first get the user_id from HttpSession
    and store the user_id in Thread Context (use ThreadLocal Object),then other java
    object invoke by the servlet can get the user_id from thread context.

    But when we use EJB,the ejb client and EJB container maybe in different machine
    and different thread,so how can I get the user_id in EJB?I don't want add the
    user_id as a parameter for every EJB method.

    Any suggestion is welcome.

    Jason Shi
    Jason.shi@ebaotech.com




  2. Re: how to pass some data from client to EJB?


    Well, I don't know what your "user_id" is, but it might be possible to derive the
    user_id somehow from the java.security.Principal obtained from the EJB context
    (javax.ejb.EJBContext). The container will give the EJB instance one of these
    when it is created.

    -- Mark --


    "Jason Shi" wrote:
    >
    >In my application,when user login system,the user_id is put into HttpSession.
    >Every time when user access the servlet,we first get the user_id from
    >HttpSession
    >and store the user_id in Thread Context (use ThreadLocal Object),then
    >other java
    >object invoke by the servlet can get the user_id from thread context.
    >
    >But when we use EJB,the ejb client and EJB container maybe in different
    >machine
    >and different thread,so how can I get the user_id in EJB?I don't want
    >add the
    >user_id as a parameter for every EJB method.
    >
    >Any suggestion is welcome.
    >
    >Jason Shi
    >Jason.shi@ebaotech.com
    >
    >
    >



+ Reply to Thread