java - how to show error message when session time out glassfish security? -


i using glassfish security realm j2ee project using jsf . session time out in 30 min.

when click on component redirecting login page thats good.

but u want before user click on component when session out dialog or msg need apear alarm user session expired .

thats why tried way didnt work using jsf listener :

<f:event listener="#{logincontroller.checksessiontimeout}" type="prerenderview"/> 

and in managed been :

public void checksessiontimeout(componentsystemevent event)      {         facescontext context = facescontext.getcurrentinstance();         httpservletrequest request = (httpservletrequest)             context.getexternalcontext().getrequest();         if (request.getrequestedsessionid()!=null && !request.isrequestedsessionidvalid())         {              system.out.println("session log out");         }     } 

but when session time out didnt print nothing me thats prove function didnt work .

if can't use omnifaces, how using idlemonitor check session status every x milliseconds? below fire when user comes web page after being away 5 minutes. problem won't fire if user sits there moving mouse around web page without doing anything, session still timeout.

<p:idlemonitor timeout="18000000"> <p:ajax event="active" listener="#{logincontroller.checksessiontimeout}" /> </p:idlemonitor> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -