I have implemented a Servlet, and a PHP site is accessing that Servlet to retrieve data. I'm wondering what is the best method to store a session variable, or whether I should store it at all.
Variables which need to be stored include an ArrayList, and other objects.
I've thought through about 3 possibilities:
(1) Implement the HttpSessionListener, and store each session (when it's created) into a static SessionMap. Then delete the session once it is destroyed.
(2) Store everything in JSON. So I'll have to serialize/deserialize each Object and pass it back and forth. (I have a list of items in each ArrayList/Object I want to keep track of between user clicks.)
(3) Store the information in MongoDB (just to pick one), using the SessionID as the primary key.
What do you guys think?