1

I've been trying to implement session timeout counter for my application build on Java EE/JSF/PrimeFaces.
Basically, the requirements are as simple as this: once user signs in, a schedule/timer is triggered and timeout clock starts ticking. There is no special event for this, the clock is fired by calling session bean method from XHTML template common for all pages when user us redirected from SSO (Keycloak in my case).
Now, when a given timeout is hit, I'd like to let the user know. And here's the problem - I'd like to show dialog box or add a message without user interaction. Unfortunately none of these is possible, because I don't have FacesContext (obviously neither do I have PF's RequestContext) which would allow me to do exactly what I want - refresh components and manipulate messages... But FacesContext is neither available in @ManagedBean's @Schedule method, nor is it in java.util. Timer or newer executor services (since separate threads are involved here).
Any ideas or similar experiences? would be grateful for any suggestions.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
pjuk
  • 11
  • 1
  • I think I know what you want and you may want to look at OmniFaces socket: http://showcase.omnifaces.org/push/socket . You could then from the server side know when the timeout happened for that user and "push" to their client the update that displays the message etc. – Melloware Aug 10 '18 at 21:54

0 Answers0