Class MongoSession
java.lang.Object
org.springframework.session.data.mongo.MongoSession
- All Implemented Interfaces:
Session
Session object providing additional information about the datetime of expiration.
- Since:
- 1.2
-
Constructor Summary
ConstructorsConstructorDescriptionMongoSession(long maxInactiveIntervalInSeconds) MongoSession(String sessionId) Constructs a new instance using the provided session id.MongoSession(String id, long maxInactiveIntervalInSeconds) MongoSession(SessionIdGenerator sessionIdGenerator) Constructs a new instance using the providedSessionIdGenerator. -
Method Summary
Modifier and TypeMethodDescriptionChanges the session id.boolean<T> TgetAttribute(String attributeName) Gets the Object associated with the specified name or null if no Object is associated to that name.Gets the attribute names that have a value associated with it.Gets the time when this session was created.getId()Gets a unique string that identifies theSession.Gets the last time thisSessionwas accessed.Gets the maximum inactive interval between requests before this session will be invalidated.inthashCode()booleanReturns true if the session is expired.voidremoveAttribute(String attributeName) Removes the attribute with the provided attribute name.voidsetAttribute(String attributeName, Object attributeValue) Sets the attribute value for the provided attribute name.voidsetLastAccessedTime(Instant lastAccessedTime) Sets the last accessed time.voidsetMaxInactiveInterval(Duration interval) Sets the maximum inactive interval between requests before this session will be invalidated.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.session.Session
getAttributeOrDefault, getRequiredAttribute
-
Constructor Details
-
MongoSession
Constructs a new instance using the provided session id.- Parameters:
sessionId- the session id to use- Since:
- 3.2
-
MongoSession
public MongoSession() -
MongoSession
public MongoSession(long maxInactiveIntervalInSeconds) -
MongoSession
-
MongoSession
Constructs a new instance using the providedSessionIdGenerator.- Parameters:
sessionIdGenerator- theSessionIdGeneratorto use- Since:
- 3.2
-
-
Method Details
-
changeSessionId
Description copied from interface:SessionChanges the session id. After invoking theSession.getId()will return a new identifier.- Specified by:
changeSessionIdin interfaceSession- Returns:
- the new session id which
Session.getId()will now return
-
getAttribute
Description copied from interface:
-