Class ProxiedSession

  • All Implemented Interfaces:
    Session
    Direct Known Subclasses:
    ImmutableProxiedSession

    public class ProxiedSession
    extends 
    implements Session
    Simple Session implementation that immediately delegates all corresponding calls to an underlying proxied session instance.

    This class is mostly useful for framework subclassing to intercept certain Session calls and perform additional logic.

    Since:
    0.9
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Session delegate
      The proxied instance
    • Constructor Summary

      Constructors 
      Constructor Description
      ProxiedSession​(Session target)
      Constructs an instance that proxies the specified target.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
       key)
      Immediately delegates to the underlying proxied session.
      <> getAttributeKeys()
      Immediately delegates to the underlying proxied session.
      getHost()
      Immediately delegates to the underlying proxied session.
      getId()
      Immediately delegates to the underlying proxied session.
      getLastAccessTime()
      Immediately delegates to the underlying proxied session.
      getStartTimestamp()
      Immediately delegates to the underlying proxied session.
      long getTimeout()
      Immediately delegates to the underlying proxied session.
       key)
      Immediately delegates to the underlying proxied session.
      void  key,  value)
      Immediately delegates to the underlying proxied session.
      void setTimeout​(long maxIdleTimeInMillis)
      Immediately delegates to the underlying proxied session.
      void stop()
      Immediately delegates to the underlying proxied session.
      void touch()
      Immediately delegates to the underlying proxied session.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Field Detail

      • delegate

        protected final Session delegate
        The proxied instance
    • Constructor Detail

      • ProxiedSession

        public ProxiedSession​(Session target)
        Constructs an instance that proxies the specified target. Subclasses may access this target via the protected final 'delegate' attribute, i.e. this.delegate.
        Parameters:
        target - the specified target Session to proxy.
    • Method Detail

      • getId

        public  getId()
        Immediately delegates to the underlying proxied session.
        Specified by:
        getId in interface Session
        Returns:
        The unique identifier assigned to the session upon creation.
      • getStartTimestamp

        public  getStartTimestamp()
        Immediately delegates to the underlying proxied session.
        Specified by:
        getStartTimestamp in interface Session
        Returns:
        The time the system created the session.
      • getLastAccessTime

        public  getLastAccessTime()
        Immediately delegates to the underlying proxied session.
        Specified by:
        getLastAccessTime in interface Session
        Returns:
        The time the user last interacted with the system.
        See Also:
        Session.touch()
      • getTimeout

        public long getTimeout()
                        throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        getTimeout in interface Session
        Returns:
        the time in milliseconds the session may remain idle before expiring.
        Throws:
        InvalidSessionException - if the session has been stopped or expired prior to calling this method.
      • setTimeout

        public void setTimeout​(long maxIdleTimeInMillis)
                        throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        setTimeout in interface Session
        Parameters:
        maxIdleTimeInMillis - the time in milliseconds that the session may remain idle before expiring.
        Throws:
        InvalidSessionException - if the session has been stopped or expired prior to calling this method.
      • getHost

        public  getHost()
        Immediately delegates to the underlying proxied session.
        Specified by:
        getHost in interface Session
        Returns:
        the host name or IP string of the host that originated this session, or null if the host address is unknown.
      • getAttributeKeys

        public <> getAttributeKeys()
                                            throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        getAttributeKeys in interface Session
        Returns:
        the keys of all attributes stored under this session, or an empty collection if there are no session attributes.
        Throws:
        InvalidSessionException - if this session has stopped or expired prior to calling this method.
      • getAttribute

        public  getAttribute​( key)
                            throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        getAttribute in interface Session
        Parameters:
        key - the unique name of the object bound to this session
        Returns:
        the object bound under the specified key name or null if there is no object bound under that name.
        Throws:
        InvalidSessionException - if this session has stopped or expired prior to calling this method.
      • setAttribute

        public void setAttribute​( key,
                                  value)
                          throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        setAttribute in interface Session
        Parameters:
        key - the name under which the value object will be bound in this session
        value - the object to bind in this session.
        Throws:
        InvalidSessionException - if this session has stopped or expired prior to calling this method.
      • removeAttribute

        public  removeAttribute​( key)
                               throws InvalidSessionException
        Immediately delegates to the underlying proxied session.
        Specified by:
        removeAttribute in interface Session
        Parameters:
        key - the name uniquely identifying the object to remove
        Returns:
        the object removed or null if there was no object bound under the name key.
        Throws:
        InvalidSessionException - if this session has stopped or expired prior to calling this method.