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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)voiddestroy()Destroys current sessionentrySet()booleanexists()Retrieve object from session.<T> TConvenience method, will do internal check for null and then cast.longReturns time when session was created.getId()returns ID of the underlying sessionid()Returns a session ID from underlying session.voidInvalidates current session.booleanisEmpty()keySet()String[]names()Returns names of current attributes as a list.Add object to a session.voidRemoves object from session.voidsetTimeToLive(int seconds)Sets time to live in seconds.intsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 throwClassCastExceptiononly 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:
containsKeyin interfaceMap<String,Object>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,Object>
-
put
Add object to a session. -
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-