AbstractNativeSessionManager

Abstract implementation supporting the {@link NativeSessionManager NativeSessionManager} interface, supporting {@link SessionListener SessionListener}s and application of the {@link #getGlobalSessionTimeout() globalSessionTimeout}.

abstract
class AbstractNativeSessionManager : AbstractSessionManager , NativeSessionManager , EventBusAware {}

Constructors

this
this()
Undocumented in source.

Members

Functions

afterStopped
void afterStopped(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
applyGlobalSessionTimeout
void applyGlobalSessionTimeout(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
beforeInvalidNotification
Session beforeInvalidNotification(Session session)

Returns the session instance to use to pass to registered {@code SessionListener}s for notification that the session has been invalidated (stopped or expired). <p/> The default implementation returns an {@link ImmutableProxiedSession ImmutableProxiedSession} instance to ensure that the specified {@code session} argument is not modified by any listeners.

checkValid
void checkValid(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
createExposedSession
Session createExposedSession(Session session, SessionContext context)
Undocumented in source. Be warned that the author may not have intended to support it.
createExposedSession
Session createExposedSession(Session session, SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
createSession
Session createSession(SessionContext context)

Creates a new {@code Session Session} instance based on the specified (possibly {@code null}) initialization data. Implementing classes must manage the persistent state of the returned session such that it could later be acquired via the {@link #getSession(SessionKey)} method.

doGetSession
Session doGetSession(SessionKey key)
Undocumented in source.
getAttribute
Object getAttribute(SessionKey sessionKey, Object attributeKey)
Undocumented in source. Be warned that the author may not have intended to support it.
getAttributeKeys
Object[] getAttributeKeys(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
getEventBus
EventBus getEventBus()

Returns the EventBus used to publish SessionEvents.

getHost
string getHost(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
getLastAccessTime
Date getLastAccessTime(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
getSession
Session getSession(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
getSessionListeners
Collection!(SessionListener) getSessionListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
getStartTimestamp
Date getStartTimestamp(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
getTimeout
long getTimeout(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
isValid
bool isValid(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyExpiration
void notifyExpiration(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyStart
void notifyStart(Session session)

Notifies any interested {@link SessionListener}s that a Session has started. This method is invoked <em>after</em> the {@link #onStart onStart} method is called.

notifyStop
void notifyStop(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
onChange
void onChange(Session s)
Undocumented in source. Be warned that the author may not have intended to support it.
onStart
void onStart(Session session, SessionContext context)

Template method that allows subclasses to react to a new session being created. <p/> This method is invoked <em>before</em> any session listeners are notified.

onStop
void onStop(Session session, SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
onStop
void onStop(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
publishEvent
void publishEvent(Object event)

Publishes events on the event bus if the event bus is non-null, otherwise does nothing.

removeAttribute
Object removeAttribute(SessionKey sessionKey, Object attributeKey)
Undocumented in source. Be warned that the author may not have intended to support it.
setAttribute
void setAttribute(SessionKey sessionKey, Object attributeKey, Object value)
Undocumented in source. Be warned that the author may not have intended to support it.
setEventBus
void setEventBus(EventBus eventBus)

Sets the EventBus to use to publish SessionEvents.

setSessionListeners
void setSessionListeners(Collection!(SessionListener) listeners)
Undocumented in source. Be warned that the author may not have intended to support it.
setTimeout
void setTimeout(SessionKey key, long maxIdleTimeInMillis)
Undocumented in source. Be warned that the author may not have intended to support it.
start
Session start(SessionContext context)
Undocumented in source. Be warned that the author may not have intended to support it.
stop
void stop(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
touch
void touch(SessionKey key)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From AbstractSessionManager

MILLIS_PER_SECOND
enum long MILLIS_PER_SECOND;
Undocumented in source.
MILLIS_PER_MINUTE
enum long MILLIS_PER_MINUTE;
Undocumented in source.
MILLIS_PER_HOUR
enum long MILLIS_PER_HOUR;
Undocumented in source.
DEFAULT_GLOBAL_SESSION_TIMEOUT
enum long DEFAULT_GLOBAL_SESSION_TIMEOUT;

Default main session timeout value, equal to {@code 30} minutes.

getGlobalSessionTimeout
long getGlobalSessionTimeout()

Returns the system-wide default time in milliseconds that any session may remain idle before expiring. This value is the main default for all sessions and may be overridden on a <em>per-session</em> basis by calling {@code Subject.getSession().}{@link Session#setTimeout setTimeout(long)} if so desired. <ul> <li>A negative return value means sessions never expire.</li> <li>A non-negative return value (0 or greater) means session timeout will occur as expected.</li> </ul> <p/> Unless overridden via the {@link #setGlobalSessionTimeout} method, the default value is {@link #DEFAULT_GLOBAL_SESSION_TIMEOUT}.

setGlobalSessionTimeout
void setGlobalSessionTimeout(long globalSessionTimeout)

Sets the system-wide default time in milliseconds that any session may remain idle before expiring. This value is the main default for all sessions and may be overridden on a <em>per-session</em> basis by calling {@code Subject.getSession().}{@link Session#setTimeout setTimeout(long)} if so desired. <p/> <ul> <li>A negative return value means sessions never expire.</li> <li>A non-negative return value (0 or greater) means session timeout will occur as expected.</li> </ul> <p/> Unless overridden by calling this method, the default value is {@link #DEFAULT_GLOBAL_SESSION_TIMEOUT}.

From NativeSessionManager

getStartTimestamp
Date getStartTimestamp(SessionKey key)

Returns the time the associated {@code Session} started (was created).

getLastAccessTime
Date getLastAccessTime(SessionKey key)

Returns the time the associated {@code Session} last interacted with the system.

isValid
bool isValid(SessionKey key)

Returns {@code true} if the associated session is valid (it exists and is not stopped nor expired), {@code false} otherwise.

checkValid
void checkValid(SessionKey key)

Returns quietly if the associated session is valid (it exists and is not stopped or expired) or throws an {@link hunt.shiro.session.InvalidSessionException} indicating that the session id is invalid. This might be preferred to be used instead of {@link #isValid} since any exception thrown will definitively explain the reason for invalidation.

getTimeout
long getTimeout(SessionKey key)

Returns the time in milliseconds that the associated session may remain idle before expiring. <ul> <li>A negative return value means the session will never expire.</li> <li>A non-negative return value (0 or greater) means the session expiration will occur if idle for that length of time.</li> </ul>

setTimeout
void setTimeout(SessionKey key, long maxIdleTimeInMillis)

Sets the time in milliseconds that the associated session may remain idle before expiring. <ul> <li>A negative return value means the session will never expire.</li> <li>A non-negative return value (0 or greater) means the session expiration will occur if idle for that length of time.</li> </ul>

touch
void touch(SessionKey key)

Updates the last accessed time of the session identified by <code>sessionId</code>. This can be used to explicitly ensure that a session does not time out.

getHost
string getHost(SessionKey key)

Returns the host name or IP string of the host where the session was started, if known. If no host name or IP was specified when starting the session, this method returns {@code null}

stop
void stop(SessionKey key)

Explicitly stops the associated session, thereby releasing all of its resources.

getAttributeKeys
Object[] getAttributeKeys(SessionKey sessionKey)

Returns all attribute keys maintained by the target session or an empty collection if there are no attributes.

getAttribute
Object getAttribute(SessionKey sessionKey, Object attributeKey)

Returns the object bound to the associated session identified by the specified attribute key. If there is no object bound under the attribute key for the given session, {@code null} is returned.

setAttribute
void setAttribute(SessionKey sessionKey, Object attributeKey, Object value)

Binds the specified {@code value} to the associated session uniquely identified by the {@code attributeKey}. If there is already a session attribute bound under the {@code attributeKey}, that existing object will be replaced by the new {@code value}. <p/> If the {@code value} parameter is null, it has the same effect as if the {@link #removeAttribute(SessionKey sessionKey, Object attributeKey)} method was called.

removeAttribute
Object removeAttribute(SessionKey sessionKey, Object attributeKey)

Removes (unbinds) the object bound to associated {@code Session} under the given {@code attributeKey}.

From EventBusAware

setEventBus
void setEventBus(EventBus bus)

Sets the available {@code EventBus} that may be used for publishing and subscribing to/from events.

Meta