Version 3

    Since JBoss Portal 2.2 it is possible to replicate the portlet sessions. This feature uses the portal session to handle the

    replication of the portlet sessions marked as distributed.


    The first step is to make sure that the portal session is distributed, you should have the <distributable/> tag set

    in the web.xml deployment descriptor of the portal-server.war file.


    The second step is to declare your portlet as distributed in the jboss-portlet.xml deployment descriptor, for instance

    if you portlet name is FooPortlet, you will have something similar to :



    <portlet-app>    <portlet>       <portlet-name>FooPortlet</portlet-name>       <session-config>          <distributed>true</distributed>       </session-config>    </portlet> </portlet-app>


    The third step is to place in your portlet application war file a listener that will listen session changes and use the events to know what data to replicate :


    <web-app>    <listener>       <listener-class>org.jboss.portal.portlet.session.SessionListener</listener-class>    </listener> </web-app>



    The advantage of this approach is that it is capable to replicate only the session of the portlets you want to replicate in a portlet application.