public class Session
extends java.lang.Object
Constructor and Description |
---|
Session(java.lang.String id,
long expiration)
Constructs a
Session . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttribute(java.lang.String name)
get a session attribute.
|
java.util.Set<java.lang.String> |
getAttributesNames() |
long |
getExpiration()
Gets the expiration.
|
java.lang.String |
getId()
Gets the id.
|
boolean |
hasExpired()
Checks whether the session has expired or not.
|
java.lang.String |
removeAttribute(java.lang.String name)
Remove an attribute from this session
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
set a session attribute
|
protected void |
setExpiration(long expiration)
Sets the expiration.
|
public Session(java.lang.String id, long expiration)
Session
.id
- the identifier of the session.expiration
- the expiration date of the session.public java.lang.String getId()
public long getExpiration()
public boolean hasExpired()
true
if the session has expired, false
otherwise.public void setAttribute(java.lang.String name, java.lang.String value)
name
- attribute namevalue
- attribute valuepublic java.lang.String getAttribute(java.lang.String name)
name
- attribute namepublic java.lang.String removeAttribute(java.lang.String name)
name
- attribute namepublic java.util.Set<java.lang.String> getAttributesNames()
protected void setExpiration(long expiration)
expiration
- the expiration to set in millis.