Class SessionTestFacade

java.lang.Object
org.javalite.activeweb.SessionTestFacade

public class SessionTestFacade extends Object
Author:
Igor Polevoy
  • Constructor Details

    • SessionTestFacade

      public SessionTestFacade(javax.servlet.http.HttpSession session)
  • Method Details

    • get

      public Object get(String name)
      Retrieve object from session.
      Parameters:
      name - name of object.
      Returns:
      named object.
    • get

      public <T> T get(String name, Class<T> type)
      Convenience method, will do internal check for null and then cast. Will throw ClassCastException 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

      public void remove(String name)
      Removes object from session.
      Parameters:
      name - name of object
    • put

      public void put(String name, Serializable value)
      Add object to a session.
      Parameters:
      name - name of object
      value - 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

      public String[] names()
      Returns names of current attributes as a list.
      Returns:
      names of current attributes as a list.
    • getSession

      protected javax.servlet.http.HttpSession getSession()