Giter Club home page Giter Club logo

mongo-tomcat-sessions's Introduction

Mongo Tomcat Session Manager

Overview

This is a tomcat session manager that saves sessions in MongoDB. It is made up of MongoManager, that provides the save/load functions, and MongoSessionTrackerValve that controls the timing of the save.

For those interested, PersistentManager/ an implementation of a SessionStore is non deterministic in when it saves to the DB, so isn't suitable as a distributed session replicator. This is why I've used a valve to control the save timing at the end of each request.

Usage

Add the following into your tomcat server.xml, or context.xml

<Valve className="com.dawsonsystems.session.MongoSessionTrackerValve" />
<Manager className="com.dawsonsystems.session.MongoManager" host="dbHost1,dbHost2" port="27017" database="sessions" maxInactiveInterval="84"/>

The Valve must be before the Manager.

The following parameters are available on the Manager :-

maxInactiveIntervalThe initial maximum time interval, in seconds, between client requests before a session is invalidated. A negative value will result in sessions never timing out. If the attribute is not provided, a default of 60 seconds is used.
processExpiresFrequencyFrequency of the session expiration, and related manager operations. Manager operations will be done once for the specified amount of backgrondProcess calls (i.e., the lower the amount, the more often the checks will occur). The minimum value is 1, and the default value is 6.
hostThe database hostnames(s). Multiple hosts can be entered, seperated by a comma
portThe database port to connect to. The same port will be used for each database host. The default is 27017
databaseThe database used to store sessions in, the default is 'sessions'

Put the mongo-store jar and the mongo java driver (I've tested with 2.3) into the tomcat lib directory and you're good to go.

mongo-tomcat-sessions's People

Contributors

dawsonsystems avatar sahilm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.