-
1. Re: Display session timeout
idyoshin Mar 15, 2010 3:17 PM (in response to remy)you can add the following count down http://www.hashemian.com/tools/javascript-countdown.htm on ajax rendered outputPanel, the only thing you should check - the target dateTime for the countdown which could be added via some expression. i.e. someTime ( now() would be great ) + session timeout.
Enytime You made ajax request that would restart the javascript.
Pure and simple.
Kind regards,
Ilya Dyoshin -
2. Re: Display session timeout
remy Mar 17, 2010 9:20 AM (in response to remy)Well, thanks, but no, this is not the solution: it counts down by itself instead of asking the server how much time is remaining. So if for some reason the session expires on server side before the counter on browser side has reached 0 (for instance because some javascript operation on browser side, like an alert() dialog, prevents the javascript counter from counting down), the user receives a
your session has expired
error message that he doesn't understand, and my help desk receives an angry callit says 'session already expired' but displays 'session expires in 10 minutes'!
... The counter should display the real value from the server, not a value it has calculated by itself.Thanks anyway! Any other solutions?
Rémy.
-
3. Re: Display session timeout
amitev Mar 17, 2010 9:40 AM (in response to remy)You can't 'ask' the server, because for every request the server will restart the timeout counting.
-
4. Re: Display session timeout
remy Mar 17, 2010 10:50 AM (in response to remy)Yes - I need a way to tell the server that it shouldn't reset the countdown when it answers this special query. It must be some configuration or annotation in Seam...
-
5. Re: Display session timeout
blabno Mar 17, 2010 4:48 PM (in response to remy)Remy, as Adrian says, every time you ask server, the session gets prolonged.
The way this wiki deals with this is having javascript timer that displays countdown, and when it goes down to 0 it shows modal panel with notification about session expiration.
There is no possibility to deal with premature session expiration without prolonging it. -
6. Re: Display session timeout
remy Mar 22, 2010 10:20 AM (in response to remy)OK, thanks. How do I start a RequestForEnhancement?
-
7. Re: Display session timeout
thokuest Mar 22, 2010 8:14 PM (in response to remy)
How do I start a RequestForEnhancement?Don't even think of it. What do you want to achieve?
Christian Bauer posted a nice article on how to handle session timeouts on the client side. You may follow his advice. If you use Richfaces, it is also possible to handle request errors such as session timeouts. Follow up with their reference guide for further information.
-
-
9. Re: Display session timeout
nobody4601 May 4, 2011 5:10 AM (in response to remy)
Ilya Dyoshin wrote on Mar 15, 2010 15:17:
you can add the following count down http://www.hashemian.com/tools/javascript-countdown.htm on ajax rendered outputPanel, the only thing you should check - the target dateTime for the countdown which could be added via some expression. i.e. someTime ( now() would be great )
Enytime You made ajax request that would restart the javascript.
Pure and simple.
Kind regards,
Ilya DyoshinHello, this sounds like a good solution for me. I need to display countdown till the end of an offer. But i do not know how to "add a target time via some expression"
Can you help me with this?Thanks.
Peter
-
10. Re: Display session timeout
kragoth May 4, 2011 9:09 PM (in response to remy)
Rémy Mouton wrote on Mar 29, 2010 09:17:
OK, got to hell.I assume this is not how you talk to your clients. If you are a professional programmer then you know better then to talk to your peers like this especially when you are asking for FREE support.
Now, people are right about the fact that requesting info from the server will automatically refresh your session timeout. This is a fact and there's no good reason to change this. (No your timer is not a good reason).
Now, if you took the time to think about your problem you could probably come up with a viable solution that would be accurate enough for 99.99% of a standard user's usage pattern.
You are concerned about the javascript countdown being blocked by a poppup/alert and thus no longer being accurate. Fair enough so, what's the logical solution here. On your template page you have a hidden input who's value is a timestamp requested from the server. On the client side on page load you grab the client's timestamp and store it in a javascript variable. Doing a diff on these times gives you the offset between your server time and the client's machine time. You also need to pass in another hidden variable (or hard code it for all anyone cares) the session timeout length.
Now assuming you have decent knowledge of javascript and math you could make a countdown that uses the offset and server time stamp, client time and session timeout value to create a countdown that is accurate even if the javascript engine is blocked by an alert for a few mins. (hint, recalculate the timer each time based on server time, client time, offset, and session timeout value)
-
11. Re: Display session timeout
remy May 5, 2011 10:18 AM (in response to remy)Please be so kind and tell me how I can stop receiving emails from this forum.
At the beginning I was interested a) in solving a certain technical question, b) in adding a feature request. My question a) was answered with
what you want is not good
and my question b) was answered withwe won't let you suggest anything
. That's why I aknowledged the encounteredopenmindedness
with the wordsgo to hell
. Now, more than one year later, I am not at all interested in an argument about communication forms. So please let me go to hell, by telling me where I can unregister from this forum. -
12. Re: Display session timeout
nobody4601 May 6, 2011 6:55 AM (in response to remy)Hi guys,
it seems, that both of you have deep knowledge about seam and web development so would you mind to help me, poor beginner, to solve my trivial problem or to pint me to the place where I can find the answer?thanks a lot!
Peter