Constructor and Description |
---|
MongoSession() |
MongoSession(long maxInactiveIntervalInSeconds) |
MongoSession(java.lang.String id,
long maxInactiveIntervalInSeconds) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
changeSessionId()
Changes the session id.
|
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.
|
java.time.Instant |
getCreationTime()
Gets the time when this session was created.
|
java.util.Date |
getExpireAt() |
java.lang.String |
getId()
Gets a unique string that identifies the
Session . |
java.time.Instant |
getLastAccessedTime()
Gets the last time this
Session was accessed. |
java.time.Duration |
getMaxInactiveInterval()
Gets the maximum inactive interval 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(java.time.Instant lastAccessedTime)
Sets the last accessed time.
|
void |
setMaxInactiveInterval(java.time.Duration interval)
Sets the maximum inactive interval between requests before this session will be
invalidated.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getAttributeOrDefault, getRequiredAttribute
public MongoSession()
public MongoSession(long maxInactiveIntervalInSeconds)
public MongoSession(java.lang.String id, long maxInactiveIntervalInSeconds)
public java.lang.String changeSessionId()
Session
Session.getId()
will return a new
identifier.changeSessionId
in interface Session
Session.getId()
will now return@Nullable 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 java.time.Instant getCreationTime()
Session
getCreationTime
in interface Session
public void setCreationTime(long created)
public java.time.Instant getLastAccessedTime()
Session
Session
was accessed.getLastAccessedTime
in interface Session
public void setLastAccessedTime(java.time.Instant lastAccessedTime)
Session
setLastAccessedTime
in interface Session
lastAccessedTime
- the last accessed timepublic java.time.Duration getMaxInactiveInterval()
Session
getMaxInactiveInterval
in interface Session
public void setMaxInactiveInterval(java.time.Duration interval)
Session
setMaxInactiveInterval
in interface Session
interval
- the amount of time that the Session
should be kept alive
between client requests.public boolean isExpired()
Session
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getId()
Session
Session
.public java.util.Date getExpireAt()
public void setExpireAt(java.util.Date expireAt)