简体   繁体   English

用户会话超时到期,长时间不抛出confirmDialog

[英]User session timeout expiry not throwing confirmDialog for long timeouts

I have a problem with the implementation of the user session timeout expiry. 我在执行用户会话超时到期时遇到问题。 In our project, we are using JSF for the web design framework and primefaces as the Facelet component. 在我们的项目中,我们将JSF用于Web设计框架,并将primefaces作为Facelet组件。 I have developed the following code in my development: 我在开发中开发了以下代码:

    <p:idleMonitor onidle="idleDialog.show();" rendered="#{loginBean.loggedIn}" timeout="#{loginBean.activeUser.userTimeOut}" />
        <p:confirmDialog header="#{lang.signOut}" message="#{lang.signOutMess}" widgetVar="idleDialog" modal="true" closable="false" appendToBody="true" >
            <p:button outcome="logout.xhtml" value="#{lang.signOut}"/>
        </p:confirmDialog>

The code above perfectly works with the users with the short timeouts such as 1-20 minutes. 上面的代码与用户超时时间较短(例如1-20分钟)的代码完美配合。 It is automatically throwing the confirm dialog with the signOutMess. 它会自动抛出带有signOutMess的确认对话框。 However, the same code is not working with the users with higher timeouts such as one hour. 但是,相同的代码不适用于超时时间较长(例如一小时)的用户。 It is not throwing the confirm dialog but signing out the user from the system. 它不会抛出确认对话框,而是从系统中注销用户。 Actually, for example if the user with the timeout - one hour time goes into one screen in the system and stayed idle on that frame for one hour, the screen is not changed but when the user tries to open another frame on the system, it is directly directing to the logout.xhtml which is actually the target and make the user to be signed out from the system but again I'd like to state, it is not throwing the confirmDialog. 实际上,例如,如果超时的用户-一个小时的时间进入系统中的一个屏幕并在该框架上保持空闲一小时,则该屏幕不会改变,但是当用户尝试打开系统上的另一帧时,直接指向logout.xhtml,它实际上是目标,并使用户从系统中注销,但是我想声明一下,它没有抛出ConfirmDialog。

What would you friends recommend me to do for that case? 您的朋友会建议我为这种情况做些什么?

Yours sincerely... 此致...

Perhaps you misunderstand what the idleTimeout component is actually doing. 也许您误会了idleTimeout组件的实际功能。 It is essentially a client side timer that can perform a server side postback or a client side event after a specified interval of inactivity. 从本质上讲,它是客户端计时器,可以在指定的不活动时间间隔后执行服务器端回发或客户端事件。 Technically speaking this can be used to help keep a users session alive. 从技术上讲,这可以用来帮助保持用户会话的活动状态。

The problem is that if there is no server side activity for a specified period of time then the users session on the server will timeout per the web application or server settings. 问题是,如果在指定的时间内没有服务器端活动,则服务器上的用户会话将根据Web应用程序或服务器设置超时。 If the session times out on the server then the idleMonitor isn't suddenly going to start working. 如果会话在服务器上超时,则idleMonitor不会突然开始工作。

You can increase the session timeout setting on your web server if 20 minutes is unacceptable. 如果无法接受20分钟,则可以增加Web服务器上的会话超时设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM