Package helma.framework.core
Class SessionBean
- java.lang.Object
-
- helma.framework.core.SessionBean
-
- All Implemented Interfaces:
java.io.Serializable
public class SessionBean extends java.lang.Object implements java.io.Serializable
The SessionBean wraps aSession
object and exposes it to the scripting framework.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SessionBean(Session session)
Creates a new SessionBean around a Session object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
get_id()
Returns the unique identifier for a session object (session cookie).java.lang.String
getCookie()
Returns the unique identifier for a session object (session cookie).INode
getData()
Get the cache/data node for this session.java.util.Date
getLastActive()
Returns the time this session was last touched.java.util.Date
getLastModified()
Gets the date at which the session was created or a login or logout was performed the last time.java.lang.String
getMessage()
Return the message that is to be displayed upon the next request within this session.java.util.Date
getOnSince()
Returns a date object representing the time a user's session was started.UploadStatus
getUploadStatus(java.lang.String uploadId)
Get an upload status for the current user session.INode
getUser()
Gets the user object for this session.java.util.Date
lastActive()
Returns the time this session was last touched.void
login(INode userNode)
Directly associates the session with a user object without requiring a username/password pair.boolean
login(java.lang.String username, java.lang.String password)
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.java.util.Date
onSince()
Returns the time this session was created.void
setLastModified(java.util.Date date)
Sets the date at which the session was created or a login or logout was performed the last time.void
setMessage(java.lang.String msg)
Set a message to be displayed to this session's user.java.lang.String
toString()
void
touch()
Touching the session marks it as active, avoiding session timeout.
-
-
-
Constructor Detail
-
SessionBean
public SessionBean(Session session)
Creates a new SessionBean around a Session object.- Parameters:
session
- ...
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- ...
-
login
public boolean login(java.lang.String username, java.lang.String password)
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
public void login(INode userNode)
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
public java.util.Date lastActive()
Returns the time this session was last touched.- Returns:
- ...
-
onSince
public java.util.Date onSince()
Returns the time this session was created.- Returns:
- ...
-
getData
public INode 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
public INode 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
public java.lang.String get_id()
Returns the unique identifier for a session object (session cookie).- Returns:
- ...
-
getCookie
public java.lang.String getCookie()
Returns the unique identifier for a session object (session cookie).- Returns:
- ...
-
getLastActive
public java.util.Date getLastActive()
Returns the time this session was last touched.- Returns:
- ...
-
getOnSince
public java.util.Date getOnSince()
Returns a date object representing the time a user's session was started.- Returns:
- ...
-
getLastModified
public java.util.Date getLastModified()
Gets the date at which the session was created or a login or logout was performed the last time.- Returns:
- ...
-
setLastModified
public void setLastModified(java.util.Date date)
Sets the date at which the session was created or a login or logout was performed the last time.- Parameters:
date
- ...
-
getMessage
public java.lang.String 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
public void setMessage(java.lang.String msg)
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
public UploadStatus getUploadStatus(java.lang.String uploadId)
Get an upload status for the current user session.- Parameters:
uploadId
- the upload id- Returns:
- the upload status
-
-