public class HiggsSession extends Object implements org.apache.shiro.session.mgt.ValidatingSession, Serializable
| Modifier and Type | Field and Description |
|---|---|
protected Map<Object,Object> |
attributes |
protected boolean |
expired |
protected String |
host |
protected Serializable |
id |
protected Date |
lastAccessTime |
protected static org.slf4j.Logger |
log |
protected static long |
MILLIS_PER_MINUTE |
protected static long |
MILLIS_PER_SECOND |
protected Date |
startTimestamp |
protected Date |
stopTimestamp |
protected long |
timeout |
| Constructor and Description |
|---|
HiggsSession() |
HiggsSession(Serializable id) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
|
protected void |
expire() |
void |
flash(Object key,
Object value)
Adds a key value pair to the session which is good for one use.
|
Object |
getAttribute(Object key) |
Collection<Object> |
getAttributeKeys() |
String |
getHost() |
Serializable |
getId() |
Date |
getLastAccessTime() |
Date |
getStartTimestamp() |
Date |
getStopTimestamp()
Returns the time the session was stopped, or null if the session is still active.
|
long |
getTimeout() |
int |
hashCode()
Returns the hashCode.
|
boolean |
isExpired()
Returns true if this session has expired, false otherwise.
|
protected boolean |
isStopped() |
protected boolean |
isTimedOut()
Determines if this session is expired.
|
boolean |
isValid() |
protected boolean |
onEquals(HiggsSession ss)
Provides an attribute-based comparison (no ID comparison) - incurred only when 'this' or the
session object being compared for equality do not have a session id.
|
Object |
removeAttribute(Object key) |
void |
setAttribute(Object key,
Object value) |
void |
setAttributes(Map<Object,Object> attributes) |
void |
setExpired(boolean expired) |
void |
setHost(String host) |
void |
setId(Serializable id) |
void |
setLastAccessTime(Date lastAccessTime) |
void |
setStopTimestamp(Date stopTimestamp) |
void |
setTimeout(long timeout) |
void |
stop() |
String |
toString()
Returns the string representation of this HiggsSession, equal to
getClass().getName() + ",id=" + getId(). |
void |
touch() |
void |
validate() |
protected static final transient org.slf4j.Logger log
protected static final long MILLIS_PER_SECOND
protected static final long MILLIS_PER_MINUTE
protected final Date startTimestamp
protected Serializable id
protected Date stopTimestamp
protected Date lastAccessTime
protected long timeout
protected boolean expired
protected String host
public HiggsSession(Serializable id)
public HiggsSession()
public void flash(Object key, Object value)
public boolean isValid()
isValid in interface org.apache.shiro.session.mgt.ValidatingSessionprotected boolean isStopped()
public boolean isExpired()
public Date getStopTimestamp()
stop()public void setStopTimestamp(Date stopTimestamp)
public void setExpired(boolean expired)
public void validate()
throws org.apache.shiro.session.InvalidSessionException
validate in interface org.apache.shiro.session.mgt.ValidatingSessionorg.apache.shiro.session.InvalidSessionExceptionpublic Serializable getId()
getId in interface org.apache.shiro.session.Sessionpublic void setId(Serializable id)
public Date getStartTimestamp()
getStartTimestamp in interface org.apache.shiro.session.Sessionpublic Date getLastAccessTime()
getLastAccessTime in interface org.apache.shiro.session.Sessionpublic void setLastAccessTime(Date lastAccessTime)
public long getTimeout()
getTimeout in interface org.apache.shiro.session.Sessionpublic void setTimeout(long timeout)
setTimeout in interface org.apache.shiro.session.Sessionpublic String getHost()
getHost in interface org.apache.shiro.session.Sessionpublic void setHost(String host)
public void touch()
touch in interface org.apache.shiro.session.Sessionpublic void stop()
stop in interface org.apache.shiro.session.Sessionpublic Collection<Object> getAttributeKeys() throws org.apache.shiro.session.InvalidSessionException
getAttributeKeys in interface org.apache.shiro.session.Sessionorg.apache.shiro.session.InvalidSessionExceptionpublic Object getAttribute(Object key)
getAttribute in interface org.apache.shiro.session.Sessionpublic void setAttribute(Object key, Object value)
setAttribute in interface org.apache.shiro.session.Sessionpublic Object removeAttribute(Object key)
removeAttribute in interface org.apache.shiro.session.Sessionprotected boolean isTimedOut()
protected void expire()
public int hashCode()
id is not null, its hashcode is returned immediately.
If it is null, an attributes-based hashCode will be calculated and returned.
Do your best to ensure HiggsSession instances receive an ID very early in their lifecycle to
avoid the more expensive attributes-based calculation.public boolean equals(Object obj)
true if the specified argument is an instanceof HiggsSession and both
ids are equal. If the argument is a HiggsSession and either 'this' or the argument
does not yet have an ID assigned, the value of onEquals is returned, which
does a necessary attribute-based comparison when IDs are not available.
Do your best to ensure HiggsSession instances receive an ID very early in their lifecycle to
avoid the more expensive attributes-based comparison.protected boolean onEquals(HiggsSession ss)
ss - the HiggsSession instance to compare for equality.Copyright © 2012-2015. All Rights Reserved.