Keeping your XPage session alive – without keepSessionAlive

<xp:div id="keepSessionAlive"></xp:div>
<xp:scriptBlock id="scriptBlock1">
    <xp:this.value>
    <![CDATA[   
        XSP.addOnLoad(function(){
            setInterval(function(){
                XSP.partialRefreshPost("#{id:keepSessionAlive}", {});   
            }, 3000000)
        })]]>
    </xp:this.value>
</xp:scriptBlock>





There appears to be an issue keeping XPage sessions alive – even with the ExtLib keepSessionAlive control – which keeps the web session alive from the server’s perspective but does not keep the XPages session alive.

This is a solution which works – especially for those people who are unable to use the Extension Library Add the following to the bottom of your XPage and what it will do is refresh the XP:DIV periodically based on your setting (in milliseconds) (3000000 = 3000 seconds = 50 minutes)

You need to set a value at least one minute less than the session timeout length set in the application properties for your database.

See - http://xomino.com/2012/09/13/keeping-your-xpage-session-alive-without-keepsessionalive/ for more detail

JavaScript (Client)
mark roden
September 14, 2012 8:03 AM
Rating
266

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...