Class MongoSessionManager

  • All Implemented Interfaces:
    SessionManager, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.LifeCycle

    @ManagedObject("Mongo Session Manager")
    public class MongoSessionManager
    extends NoSqlSessionManager
    MongoSessionManager

    Clustered session manager using MongoDB as the shared DB instance. 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

    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,
        "created"  : NumberLong("1384818548903"),
        "expiry"   : NumberLong("1384818549903"),
        "id"       : "w01ijx2vnalgv1sqrpjwuirprp7", 
        "valid"    : true 
        "context"  : { "::/contextA" : { "A"            : "A", 
                                         "__metadata__" : { "version" : NumberLong(2) } 
                                       },
                       "::/contextB" : { "B"            : "B", 
                                         "__metadata__" : { "version" : NumberLong(1) } 
                                       } 
                     } 
     }
     

    In MongoDB, the nesting level is indicated by "." separators for the key name. Thus to interact with a session attribute, the key is composed of: "context".unique_context_name.attribute_name Eg "context"."::/contextA"."A"