|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.jserv.JServSession
This is the object that encapsulates a session.
Field Summary | |
private JServServletManager |
context
The session context |
protected long |
creationTime
The time at which this session has been created |
protected java.lang.String |
id
The session id |
private boolean |
isNew
Is this session new |
protected long |
lastAccessTime
The last time the session was accessed. |
private java.util.Hashtable |
sessionData
The session data |
private boolean |
valid
Is this session valid |
Constructor Summary | |
JServSession(java.lang.String id,
JServServletManager context)
Creates a new session. |
Method Summary | |
void |
access()
Tells the session that it has been accessed |
private void |
checkState()
Throws an IllegalStateException when the session is no longer valid. |
long |
getCreationTime()
Returns the time at which this session representation was created, in milliseconds since midnight, January 1, 1970 UTC. |
java.lang.String |
getId()
Returns the identifier assigned to this session. |
long |
getLastAccessedTime()
Returns the last time the client sent a request carrying the identifier assigned to the session. |
javax.servlet.http.HttpSessionContext |
getSessionContext()
Returns the context in which this session is bound. |
java.lang.Object |
getValue(java.lang.String name)
Returns the object bound to the given name in the session's application layer data. |
java.lang.String[] |
getValueNames()
Returns an array of the names of all the application layer data objects bound into the session. |
void |
invalidate()
Causes this representation of the session to be invalidated and removed from its context. |
boolean |
isNew()
A session is considered to be "new" if it has been created by the server, but the client has not yet acknowledged joining the session. |
boolean |
isValid()
Has the session been invalidated. |
private void |
log(java.lang.String channel,
java.lang.String msg,
java.lang.Throwable t)
Logs an exception report to the servlet log file. |
void |
putValue(java.lang.String name,
java.lang.Object value)
Binds the specified object into the session's application layer data with the given name. |
private void |
readObject(java.io.ObjectInputStream stream)
Read the instance variables for this object from the specified object input stream. |
void |
removeValue(java.lang.String name)
Removes the object bound to the given name in the session's application layer data. |
(package private) void |
setSessionContext(JServServletManager context)
Sets the context in which this session is bound. |
private void |
writeObject(java.io.ObjectOutputStream stream)
Write the instance variables for this object to the specified object output stream. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.lang.String id
protected long creationTime
protected long lastAccessTime
private java.util.Hashtable sessionData
private JServServletManager context
private boolean valid
private boolean isNew
Constructor Detail |
public JServSession(java.lang.String id, JServServletManager context)
id
- The id of the session.context
- The context of the session.Method Detail |
public java.lang.String getId()
public javax.servlet.http.HttpSessionContext getSessionContext()
void setSessionContext(JServServletManager context)
This is used by JServServletManager.init() to restore the contexts to the sessions after they have been serialized out.
public long getCreationTime()
public long getLastAccessedTime()
This information is particularly useful in session management policies. For example,
public void invalidate()
public void putValue(java.lang.String name, java.lang.Object value)
name
- the name to which the data object will be bound. This
parameter cannot be null.value
- the data object to be bound. This parameter cannot be null.public java.lang.Object getValue(java.lang.String name)
name
- the name of the binding to findpublic void removeValue(java.lang.String name)
name
- the name of the object to removepublic java.lang.String[] getValueNames()
public boolean isNew()
public boolean isValid()
public void access()
private void checkState()
private void log(java.lang.String channel, java.lang.String msg, java.lang.Throwable t)
msg
- The message to be writtent
- The exception to be writtenprivate void readObject(java.io.ObjectInputStream stream) throws java.lang.ClassNotFoundException, java.io.IOException
stream
- The stream from which to readprivate void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
stream
- The stream on which to write
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |