Class ImmutableProxiedSession
java.lang.Object
org.apache.shiro.session.ProxiedSession
org.apache.shiro.session.mgt.ImmutableProxiedSession
- All Implemented Interfaces:
Session
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:
Session.setTimeout(long)Session.touch()Session.stop()Session.setAttribute(key,value)Session.removeAttribute(key)
Session.- Since:
- 0.9
-
Field Summary
Fields inherited from class org.apache.shiro.session.ProxiedSession
delegate -
Constructor Summary
ConstructorsConstructorDescriptionImmutableProxiedSession(Session target) Constructs a new instance of this class proxying the specifiedSession. -
Method Summary
Modifier and TypeMethodDescriptionremoveAttribute(Object key) ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.voidsetAttribute(Object key, Object value) ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.voidsetTimeout(long maxIdleTimeInMillis) ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.voidstop()ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.protected voidSimply throws anInvalidSessionExceptionindicating that this proxy is immutable.voidtouch()ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.Methods inherited from class org.apache.shiro.session.ProxiedSession
getAttribute, getAttributeKeys, getHost, getId, getLastAccessTime, getStartTimestamp, getTimeout
-
Constructor Details
-
ImmutableProxiedSession
Constructs a new instance of this class proxying the specifiedSession.- Parameters:
target- the targetSessionto proxy.
-
-
Method Details
-
throwImmutableException
Simply throws anInvalidSessionExceptionindicating 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
ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.- Specified by:
setTimeoutin interfaceSession- Overrides:
setTimeoutin classProxiedSession- 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
ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.- Specified by:
touchin interfaceSession- Overrides:
touchin classProxiedSession- Throws:
InvalidSessionException- if this session has stopped or expired prior to calling this method.
-
stop
ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.- Specified by:
stopin interfaceSession- Overrides:
stopin classProxiedSession- Throws:
InvalidSessionException- if this session has stopped or expired prior to calling this method.
-
setAttribute
ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.- Specified by:
setAttributein interfaceSession- Overrides:
setAttributein classProxiedSession- Parameters:
key- the name under which thevalueobject will be bound in this sessionvalue- the object to bind in this session.- Throws:
InvalidSessionException- if this session has stopped or expired prior to calling this method.
-
removeAttribute
ImmediatelythrowsanInvalidSessionExceptionin all cases because this proxy is immutable.- Specified by:
removeAttributein interfaceSession- Overrides:
removeAttributein classProxiedSession- Parameters:
key- the name uniquely identifying the object to remove- Returns:
- the object removed or
nullif there was no object bound under the namekey. - Throws:
InvalidSessionException- if this session has stopped or expired prior to calling this method.
-