0

Keep session alive programmatically

asked 2019-08-12 18:09:49 +0800

nicoladileo gravatar image nicoladileo
51 3

updated 2019-08-12 18:11:57 +0800

Hi everyone, I've developed a web application with ZK (8.0.2) + Spring Security, that make use of EventQueue and Threads to execute a long running task in background. I've tried two solutions to prevent session expires while task is still running, but none seems to work:

  1. Make a HTTP request to the server at fixed intervals
  2. Modify WebApp configuration by setting TimerKeepAlive to true

Can anybody suggest me a solutions to fix this issue? Thanks in advance

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-08-13 09:47:42 +0800

cor3000 gravatar image cor3000
4606 2 7
ZK Team

Since your descriptions are a bit incomplete it's hard to give you a solution that solves your problem. So instead I'll try to fill in the missing bits with assumptions to line out what should work.

0) Specify a session timeout (in web.xml or zk.xml) you didn't mention which so I'll just assume 5 minutes for this example

1) "make a HTTP request" (that's very vague so I can't comment on that). Just use a <timer> component which will send specific onTimer events to the server at fixed intervals (make sure those intervals are below the 5 mins configured above ... e.g. 2 minutes)

1.1) to verify the timer is firing check your browser's network console, you should see requests to /zkau containing the onTimer events

2) configure <timer-keep-alive> the documentation is quite detailed also mentioning the usage of the timer component

Last ... please test your configuration without spring security first, to verify that it works... then you can test again using spring security. If the config doesn't work anymore, you might have to check and adjust your spring security configuration.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-08-12 18:09:49 +0800

Seen: 7 times

Last updated: Aug 13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More