Package helma.framework.core

# Class SessionBean

java.lang.Object
helma.framework.core.SessionBean

All Implemented Interfaces:
  `Serializable`

public class SessionBean extends Object implements Serializable
The SessionBean wraps a `Session` 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

Modifier and Type
Method
Description
`String`
`get_id()`
Returns the unique identifier for a session object (session cookie).
`String`
`getCookie()`
Returns the unique identifier for a session object (session cookie).
`INode`
`getData()`
Get the cache/data node for this session.
`Date`
`getLastActive()`
Returns the time this session was last touched.
`Date`
`getLastModified()`
Gets the date at which the session was created or a login or logout was performed the last time.
`String`
`getMessage()`
Return the message that is to be displayed upon the next request within this session.
`Date`
`getOnSince()`
Returns a date object representing the time a user's session was started.
`UploadStatus`
`getUploadStatus(String uploadId)`
Get an upload status for the current user session.
`INode`
`getUser()`
Gets the user object for this session.
`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(String username, 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.
`Date`
`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.
`String`
`toString()`
`void`
`touch()`
Touching the session marks it as active, avoiding session timeout.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### SessionBean

public SessionBean(Session session)
Creates a new SessionBean around a Session object.

Parameters:
  `session` - ...

## Method Details

### toString

public String toString()

Overrides:
  `toString` in class `Object`
Returns:
  ...

### login

public boolean login(String username, 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 username
  `password` - 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 Date lastActive()
Returns the time this session was last touched.

Returns:
  ...

### onSince

public 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 String get_id()
Returns the unique identifier for a session object (session cookie).

Returns:
  ...

### getCookie

public String getCookie()
Returns the unique identifier for a session object (session cookie).

Returns:
  ...

### getLastActive

public Date getLastActive()
Returns the time this session was last touched.

Returns:
  ...

### getOnSince

public Date getOnSince()
Returns a date object representing the time a user's session was started.

Returns:
  ...

### getLastModified

public 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(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 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(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(String uploadId)
Get an upload status for the current user session.

Parameters:
  `uploadId` - the upload id
Returns:
  the upload status