Class MongoSessionDataStore

java.lang.Object
All Implemented Interfaces:
SessionDataMap, SessionDataStore, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

@ManagedObject public class MongoSessionDataStore extends NoSqlSessionDataStore
MongoSessionDataStore The document model is an outer object that contains the elements:
  • "id" : session_id
  • "created" : create_time
  • "accessed": last_access_time
  • "maxIdle" : max_idle_time setting as session was created
  • "expiry" : time at which session should expire
  • "valid" : session_valid
  • "context" : a nested object containing 1 nested object per context for which the session id is in use
Each of the nested objects inside the "context" element contains:
  • unique_context_name : nested object containing name:value pairs of the session attributes for that context
  • unique_context_name: vhost:contextpath, where no vhosts="0_0_0_0", root context = "", contextpath "/" replaced by "_"

One of the name:value attribute pairs will always be the special attribute "__metadata__". The value is an object representing a version counter which is incremented every time the attributes change.

For example:

 { "_id"       : ObjectId("52845534a40b66410f228f23"),
    "accessed" :  NumberLong("1384818548903"),
    "maxIdle"  : 1,
    "context"  : { "0_0_0_0:_testA" : { "A"            : "A",
                                     "__metadata__" : { "version" : NumberLong(2) }
                                   },
                   "0_0_0_0:_testB" : { "B"            : "B",
                                     "__metadata__" : { "version" : NumberLong(1) }
                                   }
                 },
    "created"  : NumberLong("1384818548903"),
    "expiry"   : NumberLong("1384818549903"),
    "id"       : "w01ijx2vnalgv1sqrpjwuirprp7",
    "valid"    : true
 }
 

In MongoDB, the nesting level is indicated by "." separators for the key name. Thus to interact with session fields, the key is composed of: "context".unique_context_name.field_name Eg "context"."0_0_0_0:_testA"."lastSaved"