Package ej.hoka.session
Class Session
- java.lang.Object
-
- ej.hoka.session.Session
-
public class Session extends Object
Server side Session.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttribute(String name)Get a session attribute.Set<String>getAttributesNames()Gets the set of the session attributes names.longgetExpiration()Gets the expiration.StringgetId()Gets the id.booleanhasExpired()Checks whether the session has expired or not.StringremoveAttribute(String name)Remove an attribute from this session.voidsetAttribute(String name, String value)Set a session attribute.protected voidsetExpiration(long expiration)Sets the expiration.
-
-
-
Method Detail
-
getId
public String getId()
Gets the id.- Returns:
- the id.
-
getExpiration
public long getExpiration()
Gets the expiration.- Returns:
- the expiration.
-
hasExpired
public boolean hasExpired()
Checks whether the session has expired or not.- Returns:
trueif the session has expired,falseotherwise.
-
setAttribute
public void setAttribute(String name, String value)
Set a session attribute.- Parameters:
name- attribute namevalue- attribute value
-
getAttribute
@Nullable public String getAttribute(String name)
Get a session attribute.- Parameters:
name- attribute name- Returns:
- return attribute mapped to this name if it exists, null otherwise
-
removeAttribute
@Nullable public String removeAttribute(String name)
Remove an attribute from this session.- Parameters:
name- attribute name- Returns:
- the previous value associated with name, or null if there was no mapping for name.
-
getAttributesNames
public Set<String> getAttributesNames()
Gets the set of the session attributes names.- Returns:
- the set of the session attributes names
-
setExpiration
protected void setExpiration(long expiration)
Sets the expiration.- Parameters:
expiration- the expiration to set in millis.
-
-