Package helma.framework.core
Class SessionBean
java.lang.Object
helma.framework.core.SessionBean
- All Implemented Interfaces:
Serializable
The SessionBean wraps a
Session
object and
exposes it to the scripting framework.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSessionBean
(Session session) Creates a new SessionBean around a Session object. -
Method Summary
Modifier and TypeMethodDescriptionget_id()
Returns the unique identifier for a session object (session cookie).Returns the unique identifier for a session object (session cookie).getData()
Get the cache/data node for this session.Returns the time this session was last touched.Gets the date at which the session was created or a login or logout was performed the last time.Return the message that is to be displayed upon the next request within this session.Returns a date object representing the time a user's session was started.getUploadStatus
(String uploadId) Get an upload status for the current user session.getUser()
Gets the user object for this session.Returns the time this session was last touched.void
Directly associates the session with a user object without requiring a username/password pair.boolean
Attempts to log in a user with the given username/password credentials.void
logout()
Disassociate this session from any user object it may have been associated with.onSince()
Returns the time this session was created.void
setLastModified
(Date date) Sets the date at which the session was created or a login or logout was performed the last time.void
setMessage
(String msg) Set a message to be displayed to this session's user.toString()
void
touch()
Touching the session marks it as active, avoiding session timeout.
-
Constructor Details
-
SessionBean
Creates a new SessionBean around a Session object.- Parameters:
session
- ...
-
-
Method Details
-
toString
-
login
Attempts to log in a user with the given username/password credentials. If username and password match, the user node is associated with the session and bound to the session.user property.- Parameters:
username
- the usernamepassword
- the password- Returns:
- true if the user exists and the password matches the user's password property.
-
login
Directly associates the session with a user object without requiring a username/password pair. This is for applications that use their own authentication mechanism.- Parameters:
userNode
- the HopObject node representing the user.
-
logout
public void logout()Disassociate this session from any user object it may have been associated with. -
touch
public void touch()Touching the session marks it as active, avoiding session timeout. Usually, sessions are touched when the user associated with it sends a request. This method may be used to artificially keep a session alive. -
lastActive
Returns the time this session was last touched.- Returns:
- ...
-
onSince
Returns the time this session was created.- Returns:
- ...
-
getData
Get the cache/data node for this session. This object may be used to store transient per-session data. It is reflected to the scripting environment as session.data. -
getUser
Gets the user object for this session. This method returns null unless one of the session.login methods was previously invoked.- Returns:
- ...
-
get_id
Returns the unique identifier for a session object (session cookie).- Returns:
- ...
-
getCookie
Returns the unique identifier for a session object (session cookie).- Returns:
- ...
-
getLastActive
Returns the time this session was last touched.- Returns:
- ...
-
getOnSince
Returns a date object representing the time a user's session was started.- Returns:
- ...
-
getLastModified
Gets the date at which the session was created or a login or logout was performed the last time.- Returns:
- ...
-
setLastModified
Sets the date at which the session was created or a login or logout was performed the last time.- Parameters:
date
- ...
-
getMessage
Return the message that is to be displayed upon the next request within this session.- Returns:
- the message, or null if none was set.
-
setMessage
Set a message to be displayed to this session's user. This can be used to save a message over to the next request when the current request can't be used to display a user visible message.- Parameters:
msg
-
-
getUploadStatus
Get an upload status for the current user session.- Parameters:
uploadId
- the upload id- Returns:
- the upload status
-