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