org.apache.shiro.session.mgt
Class ImmutableProxiedSession

java.lang.Object
  extended by org.apache.shiro.session.ProxiedSession
      extended by org.apache.shiro.session.mgt.ImmutableProxiedSession
All Implemented Interfaces:
Session

public class ImmutableProxiedSession
extends ProxiedSession

Implementation of the Session interface that proxies another Session, but does not allow any 'write' operations to the underlying session. It allows 'read' operations only.

The Session write operations are defined as follows. A call to any of these methods on this proxy will immediately result in an InvalidSessionException being thrown:

Any other method invocation not listed above will result in a corresponding call to the underlying Session.

Since:
0.9

Field Summary
 
Fields inherited from class org.apache.shiro.session.ProxiedSession
delegate
 
Constructor Summary
ImmutableProxiedSession(Session target)
          Constructs a new instance of this class proxying the specified Session.
 
Method Summary
 Object removeAttribute(Object key)
          Immediately throws an InvalidSessionException in all cases because this proxy is immutable.
 void setAttribute(Object key, Object value)
          Immediately throws an InvalidSessionException in all cases because this proxy is immutable.
 void setTimeout(long maxIdleTimeInMillis)
          Immediately throws an InvalidSessionException in all cases because this proxy is immutable.
 void stop()
          Immediately throws an InvalidSessionException in all cases because this proxy is immutable.
protected  void throwImmutableException()
          Simply throws an InvalidSessionException indicating that this proxy is immutable.
 void touch()
          Immediately throws an InvalidSessionException in all cases because this proxy is immutable.
 
Methods inherited from class org.apache.shiro.session.ProxiedSession
getAttribute, getAttributeKeys, getHost, getId, getLastAccessTime, getStartTimestamp, getTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableProxiedSession

public ImmutableProxiedSession(Session target)
Constructs a new instance of this class proxying the specified Session.

Parameters:
target - the target Session to proxy.
Method Detail

throwImmutableException

protected void throwImmutableException()
                                throws InvalidSessionException
Simply throws an InvalidSessionException indicating that this proxy is immutable. Used only in the Session's 'write' methods documented in the top class-level JavaDoc.

Throws:
InvalidSessionException - in all cases - used by the Session 'write' method implementations.

setTimeout

public void setTimeout(long maxIdleTimeInMillis)
                throws InvalidSessionException
Immediately throws an InvalidSessionException in all cases because this proxy is immutable.

Specified by:
setTimeout in interface Session
Overrides:
setTimeout in class ProxiedSession
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.

touch

public void touch()
           throws InvalidSessionException
Immediately throws an InvalidSessionException in all cases because this proxy is immutable.

Specified by:
touch in interface Session
Overrides:
touch in class ProxiedSession
Throws:
InvalidSessionException - if this session has stopped or expired prior to calling this method.

stop

public void stop()
          throws InvalidSessionException
Immediately throws an InvalidSessionException in all cases because this proxy is immutable.

Specified by:
stop in interface Session
Overrides:
stop in class ProxiedSession
Throws:
InvalidSessionException - if this session has stopped or expired prior to calling this method.

setAttribute

public void setAttribute(Object key,
                         Object value)
                  throws InvalidSessionException
Immediately throws an InvalidSessionException in all cases because this proxy is immutable.

Specified by:
setAttribute in interface Session
Overrides:
setAttribute in class ProxiedSession
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 Object removeAttribute(Object key)
                       throws InvalidSessionException
Immediately throws an InvalidSessionException in all cases because this proxy is immutable.

Specified by:
removeAttribute in interface Session
Overrides:
removeAttribute in class ProxiedSession
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.


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.