A basic session manager for cookie-based HTTP session. It allows its parent web interface to associate a "UserID" (a string) with a session ID. Formal definition of a SessionManager: A 1:1 mapping of SessionID to UserID. Queries by SessionID and UserID run in O(1). The Session ID primary key consists of: Cookie path + Cookie name + random "actual" session ID The user ID is received from the client application. Therefore, when multiple client applications want to store sessions, each one is supposed to create its own SessionManager because user IDs might overlap. The sessions of each application then get their {@link Session} by using a differentcookie path OR a different cookie namespace, depending on which constructor you use. Paths are used when client applications do NOT share the same path on the server. For example "/Chat" would cause the browser to only send back the cookie if the user is browsing "/Chat/", not for "/". BUT usually we want the menu contents of client applications to be in the logged-in state even if the user is NOT browsing the client application web interface right now, therefore the "/" path must be used in most cases. If client application cookies shall be received from all paths on the server, the client application should use the constructor which requires a cookie namespace. The usage of a namespace gurantees that Sessions of different client applications do not overlap.
@author xor (xor@freenetproject.org)
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.