mn8 Language Reference | Index | ||
ServletSession |
||
|
||
![]() |
Provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.
The servlet container uses this interface to create a session between an HTTP client and an HTTP server. The session persists for a specified time period, across more than one connection or page request from the user. A session usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such as using cookies or rewriting URLs.
A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies are intentionally turned off. Until the client joins the session, isNew returns true. If the client chooses not to join the session, getSession will return a different session on each request, and isNew will always return true.
Version: | 0.1 |
Authors: | Remus Pereni (http://neuro.nolimits.ro) |
Inherits: | Concept |
getAttributes |
Returns: Map |
Returns a map containing the attributes bound to this session.
getCreationTime |
Returns: Integer |
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
getId |
Returns: String |
Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.
getLastAccessedTime |
Returns: Integer |
Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT.
Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
getMaxInactiveInterval |
Returns: Integer |
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.
invalidate |
Invalidates this session and unbinds any attributes bound to it.
isNew |
Returns: Logical |
Returns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.
setAttributes (Map $attributes) |
Parameters: | ||
|
Set's a map with attributes to be bind to this session.
setMaxInactiveInterval (Integer $interval) |
Parameters: | ||
|
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.