Package org.javalite.activeweb
Class SessionTestFacade
java.lang.Object
org.javalite.activeweb.SessionTestFacade
- Author:
- Igor Polevoy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieve object from session.<T> T
Convenience method, will do internal check for null and then cast.long
Returns time when session was created.protected javax.servlet.http.HttpSession
void
Invalidates current session.String[]
names()
Returns names of current attributes as a list.void
put(String name, Serializable value)
Add object to a session.void
Removes object from session.void
setTimeToLive(int seconds)
Sets time to live in seconds.
-
Constructor Details
-
SessionTestFacade
public SessionTestFacade(javax.servlet.http.HttpSession session)
-
-
Method Details
-
get
Retrieve object from session.- Parameters:
name
- name of object.- Returns:
- named object.
-
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.- Parameters:
name
- name of object
-
put
Add object to a session.- Parameters:
name
- name of objectvalue
- object reference.
-
getCreationTime
public long getCreationTime()Returns time when session was created.- Returns:
- time when session was created.
-
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.
-
getSession
protected javax.servlet.http.HttpSession getSession()
-