| Constructor and Description |
|---|
StandardSession() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the object bound with the specified name in this session, or
null if no object is bound under the
name. |
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Returns an
Enumeration of String objects containing the names of all the objects bound to this
session. |
long |
getCreatedTime()
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
|
java.lang.String |
getId()
Returns a string containing the unique identifier assigned to this session.
|
long |
getLastAccessedTime()
Returns the last time the client sent a request associated with this session, as the number of milliseconds since
midnight January 1, 1970 GMT, and marked by the time the container received the request.
|
int |
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the server will keep this session open between client
accesses.
|
void |
invalidate()
Invalidates this session then unbinds any objects bound to it.
|
boolean |
isNew()
Returns
true if the client does not yet know about the session or if the client chooses not to join the
session. |
boolean |
isValid() |
void |
readObject(java.io.ObjectInputStream stream)
Read attribute values from the stream.
|
void |
removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this session.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Binds an object to this session, using the name specified.
|
void |
setCreatedTime(long createdTime) |
void |
setId(java.lang.String id) |
void |
setLastAccessedTime(long lastAccessedTime) |
void |
setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the server will invalidate this session.
|
void |
setNew(boolean aNew) |
void |
setValid(boolean valid) |
void |
writeObject(java.io.ObjectOutputStream stream)
Write attribute values to the stream.
|
public void setId(java.lang.String id)
public java.lang.String getId()
Sessionpublic void setCreatedTime(long createdTime)
public long getCreatedTime()
SessiongetCreatedTime in interface Sessionpublic void setLastAccessedTime(long lastAccessedTime)
public long getLastAccessedTime()
SessionActions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
getLastAccessedTime in interface Sessionpublic void setMaxInactiveInterval(int interval)
SessionAn interval value of zero or less indicates that the session should never timeout.
setMaxInactiveInterval in interface Sessioninterval - an integer specifying the number of seconds.public int getMaxInactiveInterval()
SessionSession.setMaxInactiveInterval(int) method.
A return value of zero or less indicates that the session will never timeout.
getMaxInactiveInterval in interface Sessionpublic java.lang.Object getAttribute(java.lang.String name)
Sessionnull if no object is bound under the
name.getAttribute in interface Sessionname - a string specifying the name of the object.public java.util.Enumeration<java.lang.String> getAttributeNames()
SessionEnumeration of String objects containing the names of all the objects bound to this
session.getAttributeNames in interface Sessionpublic void setAttribute(java.lang.String name,
java.lang.Object value)
SessionIf the value passed in is null, this has the same effect as calling Session.removeAttribute(String).
setAttribute in interface Sessionname - the name to which the object is bound, cannot be null.value - the object to be bound.public void removeAttribute(java.lang.String name)
SessionremoveAttribute in interface Sessionname - the name of the object to remove from this session.public void invalidate()
Sessioninvalidate in interface Sessionpublic void setNew(boolean aNew)
public boolean isNew()
Sessiontrue if the client does not yet know about the session or if the client chooses not to join the
session. E.g. if the server used only cookie-based sessions, and the client had disabled the use of cookies, then
a session would be new on each request.public void setValid(boolean valid)
public boolean isValid()
public void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - stream.java.io.IOException - if the output error occurs while processing this request.public void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - stream.java.lang.IllegalStateException - if a new session cannot be instantiated for any reason.java.io.IOException - if the input error occurs while processing this request.java.lang.ClassNotFoundException