Package rife.engine

Class Session

java.lang.Object
rife.engine.Session

public class Session extends Object
Convenience class that wraps around an HttpSession.
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the object bound with the specified name in this session.
    Returns a set with the names of all the objects bound to this session.
    long
    Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
    id()
    Returns a string containing the unique identifier assigned to this session.
    void
    Invalidates this session then unbinds any objects bound to it.
    boolean
    Returns true if the client does not yet know about the session
    long
    Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request
    int
    Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.
    void
    maxInactiveInterval(int interval)
    Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
    void
    Removes the object bound with the specified name from this session.
    void
    setAttribute(String name, Object value)
    Binds an object to this session, using the name specified.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • attribute

      public Object attribute(String name)
      Returns the object bound with the specified name in this session.
      Parameters:
      name - the name of the object
      Returns:
      the object with the specified name; or

      when no object can be found for that name

      Since:
      1.0
    • setAttribute

      public void setAttribute(String name, Object value)
      Binds an object to this session, using the name specified.

      If an object of the same name is already bound to the session, the object is replaced.

      If the value passed in is null, this has the same effect as calling removeAttribute(java.lang.String).

      Parameters:
      name - the name to which the object is bound; cannot be null
      value - the object to be bound to that name
      Since:
      1.0
    • attributeNames

      public Set<String> attributeNames()
      Returns a set with the names of all the objects bound to this session.
      Returns:
      the set of attribute names
      Since:
      1.0
    • removeAttribute

      public void removeAttribute(String name)
      Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.
      Parameters:
      name - the name of the object to remove from this session
      Since:
      1.0
    • creationTime

      public long creationTime()
      Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
      Returns:
      the session creation time
      Since:
      1.0
    • id

      public String id()
      Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.
      Returns:
      this session's ID
      Since:
      1.0
    • lastAccessedTime

      public long lastAccessedTime()
      Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request
      Returns:
      the last time this session was accessed
      Since:
      1.0
    • maxInactiveInterval

      public int maxInactiveInterval()
      Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session.
      Returns:
      an integer specifying the number of seconds this session remains open between client requests
      Since:
      1.0
    • maxInactiveInterval

      public void maxInactiveInterval(int interval)
      Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. An interval value of zero or less indicates that the session should never time out.
      Parameters:
      interval - the number seconds before the session expires
      Since:
      1.0
    • invalidate

      public void invalidate()
      Invalidates this session then unbinds any objects bound to it.
      Since:
      1.0
    • isNew

      public boolean isNew()
      Returns true if the client does not yet know about the session
      Returns:
      true if the server has created a session, but the client has not yet joined
      Since:
      1.0