Class AbstractMongoSessionConverter
java.lang.Object
org.springframework.session.data.mongo.AbstractMongoSessionConverter
- All Implemented Interfaces:
- org.springframework.core.convert.converter.GenericConverter
- Direct Known Subclasses:
- JacksonMongoSessionConverter,- JdkMongoSessionConverter
public abstract class AbstractMongoSessionConverter
extends Object
implements org.springframework.core.convert.converter.GenericConverter
Base class for serializing and deserializing session objects. To create custom
 serializer you have to implement this interface and simply register your class as a
 bean.
- Since:
- 1.2
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverterorg.springframework.core.convert.converter.GenericConverter.ConvertiblePair
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionconvert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) protected abstract org.springframework.session.data.mongo.MongoSessionconvert(org.bson.Document sessionWrapper) protected abstract com.mongodb.DBObjectconvert(org.springframework.session.data.mongo.MongoSession session) protected voidensureIndexes(org.springframework.data.mongodb.core.index.IndexOperations sessionCollectionIndexes) Method ensures that there is a TTL index on expireAt field.protected StringextractPrincipal(org.springframework.session.data.mongo.MongoSession expiringSession) Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>protected abstract org.springframework.data.mongodb.core.query.QuerygetQueryForIndex(String indexName, Object indexValue) Returns query to be executed to return sessions based on a particular index.voidsetIndexResolver(IndexResolver<Session> indexResolver) 
- 
Constructor Details- 
AbstractMongoSessionConverterpublic AbstractMongoSessionConverter()
 
- 
- 
Method Details- 
getQueryForIndex@Nullable protected abstract org.springframework.data.mongodb.core.query.Query getQueryForIndex(String indexName, Object indexValue) Returns query to be executed to return sessions based on a particular index.- Parameters:
- indexName- name of the index
- indexValue- value to query against
- Returns:
- built query or null if indexName is not supported
 
- 
ensureIndexesprotected void ensureIndexes(org.springframework.data.mongodb.core.index.IndexOperations sessionCollectionIndexes) Method ensures that there is a TTL index on expireAt field. It's has expireAfterSeconds set to zero seconds, so the expiration time is controlled by the application. It can be extended in custom converters when there is a need for creating additional custom indexes.- Parameters:
- sessionCollectionIndexes-- IndexOperationsto use
 
- 
extractPrincipalprotected String extractPrincipal(org.springframework.session.data.mongo.MongoSession expiringSession) 
- 
getConvertibleTypespublic Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()- Specified by:
- getConvertibleTypesin interface- org.springframework.core.convert.converter.GenericConverter
 
- 
convert@Nullable public Object convert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) - Specified by:
- convertin interface- org.springframework.core.convert.converter.GenericConverter
 
- 
convertprotected abstract com.mongodb.DBObject convert(org.springframework.session.data.mongo.MongoSession session) 
- 
convertprotected abstract org.springframework.session.data.mongo.MongoSession convert(org.bson.Document sessionWrapper) 
- 
setIndexResolver
 
-