Originally posted by William Brogden:
1. I don't see any reason to synchronize on the session.
2. Where do you recover a possible cookie from previous visits?
3. Setting the session max inactive interval to -1 means to never time out. If your servlet engine serializes sessions to a file, it would stick around forever - you might end up with lots of orphan sessions.
I don't think it has anything to do with the lifetime of the cookie on the browser that associates the browser with that session, but I might be wrong. If the browser forgets the session ID, where are you?
If you are going to deal with a lot of visitors, seems to me you need a database.
Bill
Thank you Bill as always.
Let's forget about what I wrote previously. I just want to accomplish the functionality that let's users enjoy his/her preference when they visit my site. Following are more questions I have:
Assumpsion: Users will have enabled Cookie.
1. Can you modify Cookie object that has already been created? For instance, a user wants Red to be the color of her page which, in turn, creates a cookie with color=red. A few days later she wants to change the color to Blue. Can the existing cookie be changed so that it now contains color=blue?
2. If above is possible, response.addCookie(cookie); should be called even if I am not adding NEW cookie?
3. Do you have any other/better idea how to accomplish the functionality?
I guess what I am trying to do is just like what
http://my.yahoo.com is doing. It let's me customize my own yahoo home page. Once it is done, it doesn't ask me to login all the time and I can still make changes as much as I want.