BalusC's answer helped me satisfy this requirement in my application, but since I use PrimeFaces, I would like to share how BalusC responds to the inspirational code that I use for this.
xhtml page
<p:poll listener="#{pf_usersController.keepUserSessionAlive()}" interval="#{session.maxInactiveInterval - 10}" />
bean
public void keepUserSessionAlive() { FacesContext context = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.getSession(); }
as always, thanks, BalusC!
EDIT: Endiser put this to the test this morning and it works great! my application usually forces the session timeout 15 minutes after the page is completely refreshed (redirect to sessionExpired.xhtml via meta refresh based on session.maxInactiveInterval and session timeout values in web.xml); if a user makes a bunch of AJAX requests on one page, the session will time out, because AJAX! = refresh the full page, but this code allowed enduser to "save the session" and enduser on the payroll page in the application, and the session remained alive from 1 to 2 hours! :)
source share