Session propagation mechanisms
Before we dive into the implementations of the session and its manager, let's address the issue of how the identifier is returned by the client to the server.
As was stated above, the server generates a unique identifier for the conversational state holder for a client and communicates this identifier to the client.
Statefulness will only work if the client returns that identifier back to the server, for each request that is part of that conversation.
When each new request is received, a server attempts to locate this identifier, and use it to look up the conversational state associated with this client.
If a request comes without this identifier, the server has no way of recognizing that client, and so it treats the request as having come from a brand new client.
There are two common mechanisms that are used to ensure that the session identifier is communicated across each interaction between the client and the server—cookies and URL rewriting.
Cookies
When using...