Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Default properties and methods of the session object.
SessionBean session
This object is automatically instantiated as the session property of the global object (or global.session).

The session object is a host object representing the session for the request that is currently handled by the scripting environment.

Each web request is associated with a SessionObject representing a 'user session'. Helma recognises requests being made from the same client within the same session through a session cookie named 'HopSession'. If no such cookie is sent with the request, Helma will set that a cookie with a random hash with the next response.

Within the scripting environment 'session' always represents the current session of the user, who initiated the web request.

Besides that default session object, it is also possible to fetch active sessions of other clients through the method app.getSessions(), and to create additional SessionObjects through app.createSession().

For further details also see the JavaDocs for helma.framework.core.SessionBean. Since that class is a JavaBean all get- and set-methods are also directly available as properties of that object.
String session. _id
The unique identifier for a session object (session cookie).

Contains the unique identifier of the current session, which is equivalent to the value stored in the HopSession-cookie on the client side.

This property is read-only.

String session. cookie
The cookie value of a session.

Contains the unique identifier of the current session, which is equivalent to the value stored in the HopSession-cookie on the client side.

This property is read-only.

TransientNode session. data
Object providing space for run-time user data (user cache).

This property of the SessionObject offers the possibility to store arbitrary data within the current user session. Note, that this can just be used as a temporary storage, since sessions are not stored persistently within Helma, and are generally lost when the application is restarted.

Example: = new Date(); = "en";
TransientNode session
for (var p in
  res.writeln(p + ": " +[p]);
lastclick: Fri Jul 12 14:08:20 CEST 2002
language: en
Fri Jul 12 14:08:20 CEST 2002
Date session. lastModified
The date a session was created or a login or logout was performed the last time.

This is a convenience property to acknowledge that pages are often dependent on the login status and must be re-rendered when a user has logged in, logged out or is running with a new session.

Contains the timestamp of when the associated client started the session, or logged in, or logged out the last time, whichever happened most recently.

This property is read- and write-able.

if (session.lastModified < this.modifytime)
String session. message
If set, the message will be available during the next request as res.message
User session. user
A reference to the user object associated with the current session.

Contains a reference to the UserObject associated with this session. This property is null if the client has not been logged in yet, or has already been logged out. Checking this for being unequal to null is the usual way to check whether a client is logged in or not. This property is read-only, but can be set through the method session.login(User usr).

session.login("tobi", "mumbl3");
HopObject tobi
Thu Jun 28 17:25:33 CEST 2001
session. lastActive()
A date object representing the time this user's session was last active.

Contains the timestamp of the last web request, that has been submitted by that client. This property is read-only, but can be set to the current time through session.touch().

For new sessions, if the session represents a registered user the result equals the date the user was logged in the last time; otherwise the result equals the current date.

This property is read-only

Thu Nov 02 16:12:13 GMT+01:00 2000
Date of last request by this user
session. login(user, password)
Logs in a user defined by its name and a password phrase, or by directly passing a HopObject.

There are two variants of session.login():

If called with one HopObject argument, the session is associated with the user represented by the HopObject.

If called with two string arguments, it returns true if the user name / password pair matches the stored values in the database and false otherwise.

Associates the passed User to that session, i.e. logs the client in as that User. The property user of the session object will refer to the User.

var login = session.login("tobi", "mumbl3");
if (login)
  res.write("Welcome back, " + + "!");
  res.write("Oops, please try again...");
Welcome back, tobi!
User, String user either as User object to be logged in or the username to be checked as string
String password as String, if the first parameter is a username
Boolean true if the user was logged in, otherwise false
session. logout()
Logs out a user.

Removes the reference to a User associated with the current session, if such a reference exists. Additionally the global function onLogout will be called.

[Session for user tobi]
[Anonymous Session]
session. onSince()
A date object representing the time a user's session was started.

This property is read-only.

Fri Aug 10 16:36:36 GMT+02:00 2001
Date when the current session was started.
session. touch()
Refreshes the user's session.

The session's expiration date is set to the current date plus session timeout. This also happens automatically when a user request is sent to Helma.

The lastActive property will be set to the current timestamp. Useful to artificially avoid a session timeout.

Fri Jul 12 14:40:20 CEST 2002
Fri Jul 12 14:55:20 CEST 2002
Fri, 05 Feb 2010 17:40:04 GMT.

core framework

optional modules

java libraries

properties files