Get Domino server session timeout - XPages

喜欢而已 提交于 2019-12-06 02:14:05

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.

For example:

  1. A user requests a page from a server.

  2. 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.

  3. 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.

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. A user requests a page from a server.

  2. 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.

  3. 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.

In SSJS you can get the setting of the SessionTimeout with the following code:

facesContext.getApplication().getApplicationProperty("xsp.session.timeout", "30");

But this is a static value (in minutes). The session expires in X minutes (30 is default) after the last request of the current session.

Well the timeout is reset with every interaction between server and client. So what could be done is basically have a count down on the client side that resets after every new request. And that could also be used client side to trigger a save interaction for a defined time prior to the actual session timeout.

Whether this makes sense or not is debatable... Alternatively auto-saving could be implemented aswell.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!