public class MongoExpiringSession extends java.lang.Object implements ExpiringSession
Constructor and Description |
---|
MongoExpiringSession() |
MongoExpiringSession(int maxInactiveIntervalInSeconds) |
MongoExpiringSession(java.lang.String id,
int maxInactiveIntervalInSeconds) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
<T> T |
getAttribute(java.lang.String attributeName)
Gets the Object associated with the specified name or null if no Object is
associated to that name.
|
java.util.Set<java.lang.String> |
getAttributeNames()
Gets the attribute names that have a value associated with it.
|
long |
getCreationTime()
Gets the time when this session was created in milliseconds since midnight of
1/1/1970 GMT.
|
java.util.Date |
getExpireAt() |
java.lang.String |
getId()
Gets a unique string that identifies the
Session . |
long |
getLastAccessedTime()
Gets the last time this
Session was accessed expressed in milliseconds
since midnight of 1/1/1970 GMT. |
int |
getMaxInactiveIntervalInSeconds()
Gets the maximum inactive interval in seconds between requests before this session
will be invalidated.
|
int |
hashCode() |
boolean |
isExpired()
Returns true if the session is expired.
|
void |
removeAttribute(java.lang.String attributeName)
Removes the attribute with the provided attribute name.
|
void |
setAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
Sets the attribute value for the provided attribute name.
|
void |
setCreationTime(long created) |
void |
setExpireAt(java.util.Date expireAt) |
void |
setLastAccessedTime(long lastAccessedTime)
Sets the last accessed time in milliseconds since midnight of 1/1/1970 GMT.
|
void |
setMaxInactiveIntervalInSeconds(int interval)
Sets the maximum inactive interval in seconds between requests before this session
will be invalidated.
|
public MongoExpiringSession()
public MongoExpiringSession(int maxInactiveIntervalInSeconds)
public MongoExpiringSession(java.lang.String id, int maxInactiveIntervalInSeconds)
public java.lang.String getId()
Session
Session
.public <T> T getAttribute(java.lang.String attributeName)
Session
getAttribute
in interface Session
T
- The return type of the attributeattributeName
- the name of the attribute to getpublic java.util.Set<java.lang.String> getAttributeNames()
Session
Session.getAttribute(String)
to
obtain the attribute value.getAttributeNames
in interface Session
Session.getAttribute(String)
public void setAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
Session
Session.removeAttribute(String)
.setAttribute
in interface Session
attributeName
- the attribute name to setattributeValue
- the value of the attribute to set. If null, the attribute
will be removed.public void removeAttribute(java.lang.String attributeName)
Session
removeAttribute
in interface Session
attributeName
- the name of the attribute to removepublic long getCreationTime()
ExpiringSession
getCreationTime
in interface ExpiringSession
public void setCreationTime(long created)
public void setLastAccessedTime(long lastAccessedTime)
ExpiringSession
setLastAccessedTime
in interface ExpiringSession
lastAccessedTime
- the last accessed time in milliseconds since midnight of
1/1/1970 GMTpublic long getLastAccessedTime()
ExpiringSession
Session
was accessed expressed in milliseconds
since midnight of 1/1/1970 GMT.getLastAccessedTime
in interface ExpiringSession
public void setMaxInactiveIntervalInSeconds(int interval)
ExpiringSession
setMaxInactiveIntervalInSeconds
in interface ExpiringSession
interval
- the number of seconds that the Session
should be kept alive
between client requests.public int getMaxInactiveIntervalInSeconds()
ExpiringSession
getMaxInactiveIntervalInSeconds
in interface ExpiringSession
public boolean isExpired()
ExpiringSession
isExpired
in interface ExpiringSession
public java.util.Date getExpireAt()
public void setExpireAt(java.util.Date expireAt)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object