helma.framework.core
Class Session

java.lang.Object
  extended by helma.framework.core.Session
All Implemented Interfaces:
java.io.Serializable

public class Session
extends java.lang.Object
implements java.io.Serializable

This represents a session currently using the Hop application. This includes anybody who happens to request a page from this application. Depending on whether the user is logged in or not, the session holds a persistent user node.

See Also:
Serialized Form

Field Summary
protected  Application app
           
protected  INode cacheNode
           
protected  java.lang.StringBuffer debugBuffer
           
protected  long lastModified
           
protected  long lastTouched
           
protected  java.lang.String message
           
protected  long onSince
           
protected  java.lang.String sessionId
           
protected  java.lang.String uid
           
protected  java.util.HashMap uploads
           
protected  NodeHandle userHandle
           
 
Constructor Summary
Session(java.lang.String sessionId, Application app)
          Creates a new Session object.
 
Method Summary
 void commit(RequestEvaluator reval)
          Called after a request has been handled.
protected  UploadStatus createUpload(java.lang.String uploadId)
           
 Application getApp()
          Get this session's application
 INode getCacheNode()
          Gets the transient cache node.
 java.lang.StringBuffer getDebugBuffer()
          Return the debug buffer that is to be displayed upon the next request within this session.
 java.lang.String getMessage()
          Return the message that is to be displayed upon the next request within this session.
 java.lang.String getSessionId()
          Return this session's id.
 java.lang.String getUID()
          Get the persistent user id of a registered user.
protected  UploadStatus getUpload(java.lang.String uploadId)
           
 NodeHandle getUserHandle()
          Get the Node handle for the current user, if logged in.
 INode getUserNode()
          Gets the user Node from this Application's NodeManager.
 boolean isLoggedIn()
          Returns true if this session is currently associated with a user object.
 long lastModified()
          Returns the time this session was last modified, meaning the last time its user status changed or its cache node was modified.
 long lastTouched()
          Returns the time this session was last touched.
 void login(INode usernode)
          Attach the given user node to this session.
 boolean login(java.lang.String userName, java.lang.String password)
          Try logging in this session given the userName and password.
 void logout()
          Remove this sessions's user node.
 long onSince()
          Return the time this session was created.
protected  void pruneUploads()
           
 void recoverResponseMessages(ResponseTrans res)
          Set the user and debug messages over from a previous response.
 void setApp(Application app)
          Set this session's application
 void setCacheNode(INode node)
          Set the cache node for this session.
 void setDebugBuffer(java.lang.StringBuffer buffer)
          Set the debug buffer to be displayed to this session's user.
 void setLastModified(java.util.Date date)
          Set the last modified time on this session.
 void setMessage(java.lang.String msg)
          Set a message to be displayed to this session's user.
 void setUserHandle(NodeHandle handle)
          Set the user handle for this session.
 void storeResponseMessages(ResponseTrans res)
          Remember the response's user and debug messages for a later response.
 java.lang.String toString()
          Return a string representation for this session.
 void touch()
          Called at the beginning of a request to let the session know it's being used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

app

protected transient Application app

sessionId

protected java.lang.String sessionId

uid

protected java.lang.String uid

userHandle

protected NodeHandle userHandle

cacheNode

protected INode cacheNode

onSince

protected long onSince

lastTouched

protected long lastTouched

lastModified

protected long lastModified

message

protected java.lang.String message

debugBuffer

protected java.lang.StringBuffer debugBuffer

uploads

protected java.util.HashMap uploads
Constructor Detail

Session

public Session(java.lang.String sessionId,
               Application app)
Creates a new Session object.

Parameters:
sessionId - ...
app - ...
Method Detail

login

public void login(INode usernode)
Attach the given user node to this session.


login

public boolean login(java.lang.String userName,
                     java.lang.String password)
Try logging in this session given the userName and password.

Parameters:
userName -
password -
Returns:
true if session was logged in.

logout

public void logout()
Remove this sessions's user node.


isLoggedIn

public boolean isLoggedIn()
Returns true if this session is currently associated with a user object.

Returns:
...

setUserHandle

public void setUserHandle(NodeHandle handle)
Set the user handle for this session.


getUserHandle

public NodeHandle getUserHandle()
Get the Node handle for the current user, if logged in.


getUserNode

public INode getUserNode()
Gets the user Node from this Application's NodeManager.


setCacheNode

public void setCacheNode(INode node)
Set the cache node for this session.


getCacheNode

public INode getCacheNode()
Gets the transient cache node.


getApp

public Application getApp()
Get this session's application

Returns:
...

setApp

public void setApp(Application app)
Set this session's application

Parameters:
app - ...

getSessionId

public java.lang.String getSessionId()
Return this session's id.

Returns:
...

touch

public void touch()
Called at the beginning of a request to let the session know it's being used.


commit

public void commit(RequestEvaluator reval)
Called after a request has been handled.

Parameters:
reval - the request evaluator that handled the request

lastTouched

public long lastTouched()
Returns the time this session was last touched.

Returns:
...

lastModified

public long lastModified()
Returns the time this session was last modified, meaning the last time its user status changed or its cache node was modified.

Returns:
...

setLastModified

public void setLastModified(java.util.Date date)
Set the last modified time on this session.

Parameters:
date - ...

onSince

public long onSince()
Return the time this session was created.

Returns:
...

toString

public java.lang.String toString()
Return a string representation for this session.

Overrides:
toString in class java.lang.Object
Returns:
...

getUID

public java.lang.String getUID()
Get the persistent user id of a registered user. This is usually the user name, or null if the user is not logged in.


recoverResponseMessages

public void recoverResponseMessages(ResponseTrans res)
Set the user and debug messages over from a previous response. This is used for redirects, where messages can't be displayed immediately.

Parameters:
res - the response to set the messages on

storeResponseMessages

public void storeResponseMessages(ResponseTrans res)
Remember the response's user and debug messages for a later response. This is used for redirects, where messages can't be displayed immediately.

Parameters:
res - the response to retrieve the messages from

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 - the message

getDebugBuffer

public java.lang.StringBuffer getDebugBuffer()
Return the debug buffer that is to be displayed upon the next request within this session.

Returns:
the debug buffer, or null if none was set.

setDebugBuffer

public void setDebugBuffer(java.lang.StringBuffer buffer)
Set the debug buffer to be displayed to this session's user. This can be used to save the debug buffer over to the next request when the current request can't be used to display a user visible message.

Parameters:
buffer - the buffer

createUpload

protected UploadStatus createUpload(java.lang.String uploadId)

getUpload

protected UploadStatus getUpload(java.lang.String uploadId)

pruneUploads

protected void pruneUploads()


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.