Package helma.framework.core
Class Session
java.lang.Object
helma.framework.core.Session
- All Implemented Interfaces:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Application
protected long
protected INode
protected StringBuffer
protected long
protected long
protected String
protected boolean
protected long
protected boolean
protected String
protected String
protected HashMap
protected NodeHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
commit
(RequestEvaluator reval, SessionManager smgr) Called after a request has been handled.protected UploadStatus
createUpload
(String uploadId) getApp()
Get this session's applicationGets the transient cache node.Return the debug buffer that is to be displayed upon the next request within this session.Return the message that is to be displayed upon the next request within this session.Return this session's id.getUID()
Get the persistent user id of a registered user.protected UploadStatus
Get the Node handle for the current user, if logged in.Gets the user Node from this Application's NodeManager.boolean
Returns true if this session is currently associated with a user object.long
Returns the time this session was last modified, meaning the last time its user status changed or its cache node was modified.long
Returns the time this session was last touched.void
Attach the given user node to this session.boolean
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
void
Set the user and debug messages over from a previous response.void
setApp
(Application app) Set this session's applicationvoid
setCacheNode
(INode node) Set the cache node for this session.void
setDebugBuffer
(StringBuffer buffer) Set the debug buffer to be displayed to this session's user.void
setLastModified
(long l) Set the last modified time on this session.void
setMessage
(String msg) Set a message to be displayed to this session's user.void
Set the persistent user id of a registered user.void
setUserHandle
(NodeHandle handle) Set the user handle for this session.void
Remember the response's user and debug messages for a later response.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.
-
Field Details
-
app
-
sessionId
-
uid
-
userHandle
-
cacheNode
-
onSince
protected long onSince -
lastTouched
protected long lastTouched -
lastModified
protected long lastModified -
cacheLastModified
protected long cacheLastModified -
message
-
debugBuffer
-
uploads
-
modifiedInRequest
protected transient boolean modifiedInRequest -
registered
protected transient boolean registered
-
-
Constructor Details
-
Session
Creates a new Session object.- Parameters:
sessionId
- ...app
- ...
-
-
Method Details
-
login
Attach the given user node to this session. -
login
Try logging in this session given the userName and password.- Parameters:
userName
- the user namepassword
- the 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
Set the user handle for this session. -
getUserHandle
Get the Node handle for the current user, if logged in. -
getUserNode
Gets the user Node from this Application's NodeManager. -
setCacheNode
Set the cache node for this session. -
getCacheNode
Gets the transient cache node. -
getApp
Get this session's application- Returns:
- ...
-
setApp
Set this session's application- Parameters:
app
- ...
-
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
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(long l) Set the last modified time on this session.- Parameters:
l
- the timestamp
-
onSince
public long onSince()Return the time this session was created.- Returns:
- ...
-
toString
Return a string representation for this session. -
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. -
setUID
Set the persistent user id of a registered user.- Parameters:
uid
- the user name, or null if the user is not logged in.
-
recoverResponseMessages
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
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
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
- the message
-
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
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
-
getUpload
-
pruneUploads
protected void pruneUploads()
-