Package org.javalite.activeweb
Class SessionFacade
java.lang.Object
org.javalite.activeweb.SessionFacade
Facade to HTTP session.
- Author:
- Igor Polevoy
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
void
destroy()
Destroys current sessionentrySet()
boolean
exists()
Retrieve object from session.<T> T
Convenience method, will do internal check for null and then cast.long
Returns time when session was created.getId()
returns ID of the underlying sessionid()
Returns a session ID from underlying session.void
Invalidates current session.boolean
isEmpty()
keySet()
String[]
names()
Returns names of current attributes as a list.Add object to a session.void
Removes object from session.void
setTimeToLive(int seconds)
Sets time to live in seconds.int
size()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
SessionFacade
public SessionFacade()
-
-
Method Details
-
exists
public boolean exists() -
id
Returns a session ID from underlying session.- Returns:
- a session ID from underlying session, or null if session does not exist.
-
get
Retrieve object from session. -
get
Convenience method, will do internal check for null and then cast. Will throwClassCastException
only in case the object in session is different type than expected.- Parameters:
name
- name of session object.type
- expected type- Returns:
- object in session, or null if not found.
-
remove
Removes object from session. -
getCreationTime
public long getCreationTime()Returns time when session was created.- Returns:
- time when session was created or -1 if session is not exists.
-
invalidate
public void invalidate()Invalidates current session. All attributes are discarded. -
setTimeToLive
public void setTimeToLive(int seconds)Sets time to live in seconds.- Parameters:
seconds
- time to live.
-
names
Returns names of current attributes as a list.- Returns:
- names of current attributes as a list.
-
getId
returns ID of the underlying session- Returns:
- ID of the underlying session
-
destroy
public void destroy()Destroys current session -
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<String,Object>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,Object>
-
put
Add object to a session. -
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-