Class HttpSessionAdapter

java.lang.Object
com.aspectran.core.adapter.AbstractSessionAdapter
com.aspectran.web.adapter.HttpSessionAdapter
All Implemented Interfaces:
SessionAdapter

public class HttpSessionAdapter extends AbstractSessionAdapter
Adapt HttpServletRequest to Core SessionAdapter.
Since:
2011. 3. 13.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpSessionAdapter(jakarta.servlet.http.HttpServletRequest request)
    Instantiates a new HttpSessionAdapter.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    <T> T
    Returns the adaptee object to provide session information.
    <T> T
    Returns the value of the named attribute as a given type, or null if no attribute of the given name exists.
    Returns an Enumeration of String objects containing 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.
    Returns a string containing the unique identifier assigned to this 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 session manager will keep this session open between client accesses.
    jakarta.servlet.http.HttpSession
    getSession(boolean create)
     
    void
    Invalidates this session then unbinds any objects bound to it.
    boolean
    Returns true if a new session was created for this request.
    boolean
    Returns whether it is a valid session or not.
    void
    Removes the object bound with the specified name from this session.
    void
    setAttribute(String name, Object value)
    Stores an attribute in this session.
    void
    setMaxInactiveInterval(int interval)
    Specifies the time, in seconds, between client requests before invalidating the session.

    Methods inherited from class com.aspectran.core.adapter.AbstractSessionAdapter

    getSessionScope, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HttpSessionAdapter

      public HttpSessionAdapter(jakarta.servlet.http.HttpServletRequest request)
      Instantiates a new HttpSessionAdapter.
      Parameters:
      request - the HTTP request
  • Method Details

    • getAdaptee

      public <T> T getAdaptee()
      Description copied from interface: SessionAdapter
      Returns the adaptee object to provide session information.
      Specified by:
      getAdaptee in interface SessionAdapter
      Overrides:
      getAdaptee in class AbstractSessionAdapter
      Type Parameters:
      T - the type of the adaptee object
      Returns:
      the adaptee object
    • createSessionScope

      public SessionScope createSessionScope()
      Overrides:
      createSessionScope in class AbstractSessionAdapter
    • getId

      public String getId()
      Description copied from interface: SessionAdapter
      Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the session manager and is implementation dependent.
      Returns:
      a string specifying the identifier assigned to this session
    • getCreationTime

      public long getCreationTime()
      Description copied from interface: SessionAdapter
      Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
      Returns:
      a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT
    • getLastAccessedTime

      public long getLastAccessedTime()
      Description copied from interface: SessionAdapter
      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. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
      Returns:
      a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT
    • getMaxInactiveInterval

      public int getMaxInactiveInterval()
      Description copied from interface: SessionAdapter
      Returns the maximum time interval, in seconds, that the session manager will keep this session open between client accesses. After this interval, the session manager will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never time out.
      Returns:
      an integer specifying the number of seconds this session remains open between client requests
    • setMaxInactiveInterval

      public void setMaxInactiveInterval(int interval)
      Description copied from interface: SessionAdapter
      Specifies the time, in seconds, between client requests before invalidating the session. A negative time indicates the session should never timeout.
      Parameters:
      interval - an integer specifying the number of seconds
    • getAttributeNames

      public Enumeration<String> getAttributeNames()
      Description copied from interface: SessionAdapter
      Returns an Enumeration of String objects containing the names of all the objects bound to this session.
      Returns:
      an Enumeration of String objects specifying the names of all the objects bound to this session
    • getAttribute

      public <T> T getAttribute(String name)
      Description copied from interface: SessionAdapter
      Returns the value of the named attribute as a given type, or null if no attribute of the given name exists.
      Type Parameters:
      T - the generic type
      Parameters:
      name - a String specifying the name of the attribute
      Returns:
      an Object containing the value of the attribute, or null if the attribute does not exist
    • setAttribute

      public void setAttribute(String name, Object value)
      Description copied from interface: SessionAdapter
      Stores an attribute in this session.
      Parameters:
      name - specifying the name of the attribute
      value - the Object to be stored
    • removeAttribute

      public void removeAttribute(String name)
      Description copied from interface: SessionAdapter
      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
    • invalidate

      public void invalidate()
      Description copied from interface: SessionAdapter
      Invalidates this session then unbinds any objects bound to it.
    • isValid

      public boolean isValid()
      Description copied from interface: SessionAdapter
      Returns whether it is a valid session or not.
      Returns:
      true if valid session, false otherwise
    • isNew

      public boolean isNew()
      Description copied from interface: SessionAdapter
      Returns true if a new session was created for this request.
      Returns:
      true if the server has created a session, but the client has not yet joined
    • getSession

      public jakarta.servlet.http.HttpSession getSession(boolean create)