Chapter 6. Session Management: Conversational state
Web servers have no short-term memory. As soon as they send you a response, they forget who you are. The next time you make a request, they don’t recognize you. In other words, they don’t remember what you’ve requested in the past, and they don’t remember what they’ve sent you in response. Nothing. Sometimes that’s fine. But sometimes you need to keep conversational state with the client across multiple requests. A shopping cart wouldn’t work if the client had to make all his choices and then checkout in a single request. You’ll find a surprisingly simple solution in the Servlet API.
Write servlet code to store objects into a session object and retrieve objects from a session object.
Given a scenario describe the APIs used to access the session object, explain when the session object was created, and describe the mechanisms used to destroy the session object, and when it was destroyed.
Using session listeners, write code to respond to an event when an object is added to a session, and write code to respond to an event when a session object migrates from one VM to another.
Given a scenario, describe which session management mechanism the Web container could employ, how cookies might be used to manage sessions, how URL rewriting might be used to manage sessions, and write servlet code to perform ...