获取Domino服务器会话超时-XPages [英] Get Domino server session timeout - XPages

查看:196
本文介绍了获取Domino服务器会话超时-XPages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在XPages-SSJS中获得Domino服务器的会话超时.我想提示用户在会话过期之前保存他/她的数据.谢谢

How to get session timeout of Domino server in XPages-SSJS. I want to prompt user to save his/her data before session expires. Thanks

推荐答案

服务器仅在用户向服务器发出请求时才与用户通信.

Servers only communicate with users when those users make a request to the server.

因此,如果服务器未请求信息,则无法将信息发送给用户.

Because of this, servers cannot send information to the user if they haven't requested it.

例如:

  1. 用户从服务器请求页面.

  1. A user requests a page from a server.

服务器将该页面发送回用户,并创建一个会话 对于该用户.该会话设置为在5分钟后过期.

The server sends that page back to the user, and creates a session for that user. The session is set to expire in 5 minutes.

这5分钟到了,与此同时,用户还没有请求 任何其他页面.这样用户会话结束,但是因为用户 没有发出任何请求,服务器无法传达此信息 给用户.

Those 5 minutes are up, and in the meantime the user hasn't requested any further pages. So the users session ends, but because the user isn't making any requests, the server has no way of communicating this to the user.

这只是HTTP通信设计的工作方式.但是,有多种方法可以解决,通过更改上面的示例,我将向您展示最简单的方法之一:

This is just the way that HTTP traffic is designed to work. There are ways around this however, and by altering the example above I will show you one of the easiest ways:

  1. 用户从服务器请求页面.

  1. A user requests a page from a server.

服务器将该页面发送回用户,并创建一个会话 对于该用户.会话设置为在5分钟后过期.该页面 服务器发回的邮件具有javascript setTimeout函数,该函数设置为在服务器会话到期之前触发.

The server sends that page back to the user, and creates a session for that user. The session is set to expire in 5 minutes. The page that the server sends back has a javascript setTimeout function which is set to fire off just before the session of the server expires.

这5分钟到了,又一次,用户没有请求 任何其他页面.因此,用户会话结束,服务器无法传达此信息 给用户. 但是,页面上的javascript知道服务器上的会话即将到期,并发出警报以告知用户保存其工作.

Those 5 minutes are up, and again, the user hasn't requested any further pages. So the users session ends and the server has no way of communicating this to the user. However, javascript on the page knows that the session on the server is due to expire, and fires off an alert to tell the user to save their work.

这篇关于获取Domino服务器会话超时-XPages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆