0

I have implemented ViewExpiredException handling as described here and here (Thank you @BalusC and team). It is working properly. However, the error page flashes by so quickly that the user is not informed that he/she has been redirected due to a session timeout. Is there a way to slow things down a bit?

Here is the error page:

<html lang="en">
<head>
    <title>Session Expired</title>
    <meta http-equiv="refresh" content="0;url=#{request.contextPath}/index.xhtml" />
</head>
<body>
    <h1>Session Expired</h1>
    <h3>You will be redirected to the starting page</h3>
    <p><a href="#{request.contextPath}/index.xhtml">Click here if the redirect didn't work or if you are impatient.</a></p>
</body>

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Verticon
  • 2,419
  • 16
  • 34
  • I would not expect it to disappear. Sure you don't have some http meta refresh or something in your error page? – Kukeltje Jun 05 '18 at 17:11
  • Yes, I do (I added the error page to the question). Would it be better to wait for a user click> – Verticon Jun 05 '18 at 19:06
  • You did not know/notice this before posting? Would have saved you the time creating the question since it is not jsf related at all (Would have saved me time too ;-)). And the same problem occurs if you use this a plain http server error page. Best solution is up to you. Add a several second delay or wait for a click – Kukeltje Jun 05 '18 at 19:20
  • Sorry to have been incomplete, Kukeltje. Somehow I got it into my head that redirecting was the normal way to handle the timeout exception. I don't know how to add a delay - that is really what I was asking. I suppose I should have posted with an http or html tag – Verticon Jun 05 '18 at 20:24
  • Uhhhh... then please learn what `content="0;` does... [mcve]... always... ;-) – Kukeltje Jun 05 '18 at 20:38
  • Btw only use the jsf-2.3 tag for jsf specific issues. Tags are not for for what you use nut where the problem is – Kukeltje Jun 05 '18 at 20:49
  • I'll be more diligent in the future. – Verticon Jun 05 '18 at 20:54
  • Looks like you didn't read the text around the section where you copypasted this error page code example from .. The footnote already contained the answer. – BalusC Jun 05 '18 at 23:20
  • I see it now. Sorry to have missed that. – Verticon Jun 06 '18 at 14:42

1 Answers1

0

The behaviour is exactly as you tell it to behave

 <meta http-equiv="refresh" content="0;url=#{request.contextPath}/index.xhtml" />

The content="0 in there means: "Don't wait but redirect immediately". Changing the 0 to 10 will make it wait 10 seconds,

<meta http-equiv="refresh" content="10;url=#{request.contextPath}/index.xhtml" />

Effectively this is not jsf related at all but plain html. Same would have been a problem with a normal 404 error page

Kukeltje
  • 12,223
  • 4
  • 24
  • 47