Reputation: 1
I'm writing a web service in Java EE 6 with several web methods. I need a variable that could be assigned in one web method and read in another web method ran lately. The variable should be instantiated once and only once for each user accessing the web service (it should be directly associated to each user, with a different value per user).
Can I do this in Java? Thank you.
Upvotes: 0
Views: 164
Reputation: 1021
Have you thought about using a Session? There are various ways to do this, including cookies, DB backed, etc, and then you just load the session when the user logs back in (or visits again but is still 'logged in' due to a cookie).
Upvotes: 1