public class ImmutableProxiedSession extends ProxiedSession
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
.delegate
Constructor and Description |
---|
ImmutableProxiedSession(Session target)
Constructs a new instance of this class proxying the specified
Session . |
Modifier and Type | Method and Description |
---|---|
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. |
getAttribute, getAttributeKeys, getHost, getId, getLastAccessTime, getStartTimestamp, getTimeout
public ImmutableProxiedSession(Session target)
Session
.target
- the target Session
to proxy.protected void throwImmutableException() throws InvalidSessionException
InvalidSessionException
indicating that this proxy is immutable. Used
only in the Session's 'write' methods documented in the top class-level JavaDoc.InvalidSessionException
- in all cases - used by the Session 'write' method implementations.public void setTimeout(long maxIdleTimeInMillis) throws InvalidSessionException
throws
an InvalidSessionException
in all
cases because this proxy is immutable.setTimeout
in interface Session
setTimeout
in class ProxiedSession
maxIdleTimeInMillis
- the time in milliseconds that the session may remain idle before expiring.InvalidSessionException
- if the session has been stopped or expired prior to calling this method.public void touch() throws InvalidSessionException
throws
an InvalidSessionException
in all
cases because this proxy is immutable.touch
in interface Session
touch
in class ProxiedSession
InvalidSessionException
- if this session has stopped or expired prior to calling this method.public void stop() throws InvalidSessionException
throws
an InvalidSessionException
in all
cases because this proxy is immutable.stop
in interface Session
stop
in class ProxiedSession
InvalidSessionException
- if this session has stopped or expired prior to calling this method.public void setAttribute(Object key, Object value) throws InvalidSessionException
throws
an InvalidSessionException
in all
cases because this proxy is immutable.setAttribute
in interface Session
setAttribute
in class ProxiedSession
key
- the name under which the value
object will be bound in this sessionvalue
- the object to bind in this session.InvalidSessionException
- if this session has stopped or expired prior to calling
this method.public Object removeAttribute(Object key) throws InvalidSessionException
throws
an InvalidSessionException
in all
cases because this proxy is immutable.removeAttribute
in interface Session
removeAttribute
in class ProxiedSession
key
- the name uniquely identifying the object to removenull
if there was no object bound under the name
key
.InvalidSessionException
- if this session has stopped or expired prior to calling
this method.Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.