cookie-session module

getSession ( { String path {, int maxAge {, String cookieName {, String domain {, boolean secure } } } } } )

This function returns a Map object that consists of key-value mappings associated with the current session. The session management is based on Cookies.

When path is not null, this function first searches a session object that matches the path name, then, if no session is found, a cookie with the Path attribute is created. When path is null (default), it first searches a session object in a way that sessions with more specific path names precedes those with less specific. If no session is found, a cookie with the context path is created.

maxAge is used as the cookie's attribute for maximum age (in seconds), when first created. The default value of maxAge is -1, which means that the cookie of the session is not stored persistently and will be deleted when the Web browser exits.

cookieName is used as the cookie's name. If null is specified, "PnutsSession" is used as the default value.

domain is used as Domain attribute of the cookie.

If secure true, the session is only available using a secure protocol, such as HTTPS or SSL. The default value of secure is false.

function currentSession()  getSession("/", -1)

currentSession().userID = "myname"
...
currentSession().userID