Version 1



    One of the use cases where we can use Infinispan is as a externalized HTTP Session of an App Server.


    Indeed, JBoss AS 7 / EAP 6 use internally Infinispan to manage sharing HTTP Sessions.


    But, also you can do it in several App Server just using the Java EE filter specification.


    For example, you can add a filter that catches a HTTP request and wrapper the HTTP session, so you can sync with Infinispan to retrieve and populate an external Sessions, like a session passivation but in memory instead to use disk.


    Use cases: imagine that you have a server with limited amount of RAM (i.e. 2 Gb) and you want to storage 100 Gb of user sessions, we can use Infinispan for this use case with a better impact instead to use a database to externalize it.


    I've attached an example where you only have to configure the filter in your web.xml:















    And add Infinispan libs in the WEB-INF/lib or your classpath.


    So, you don't need to add <distributable /> in your web.xml, Infinispan will deal with the distribution of the HTTP Session in the datagrid.




    Filter manages an additional cookie to sync JDG HTTP session across all cluster nodes, in parallel to the session ID managed by the app server.


    Hope it can be useful.


    Comments and feedback are welcome !