Routing error when setting setMaxInactiveInterval

Hi,

in our app the user calls a view with Anonymous allowed where the passed URL information is used to do the login via coding.
After the successful login the user gets relinked to another page.
Works fine.

Now I want to set the setMaxInactiveInterval using this code:
VaadinSession.getCurrent().getSession().setMaxInactiveInterval(setSessionTimeoutSec);

This is causing an error when the user tries to open the app (custom login view):
Routing is not in use or not yet initialized. If you are not using embedded UI, try postponing the call to an onAttach method or to an AfterNavigationEvent listener.

When closing the browser and doing the same call again,
it works.

The VaadinSession coding is placed in the onAttachEvent…
Any idea how to solve this?

  • set the setMaxInactiveInterval somewhere else?
  • initializing the routing via coding before that the setMaxInactiveInterval?

KR
Roland

I placed the setMaxInactiveInterval into button action…
makes sense, because without any interaction from the user after opening the app,
its OK to close the session after 5 min…
when the user clicks on a button, the timeout is set and going this way
the error message regarding the inactive routing is not popping up…