Can you use the session.getLastAccessedTime, session.getMaxInactiveInterval, and System.currentTimeMillis to calculate the remaining session time?
-----Original Message----- From: Anne-Li Mell [mailto:[EMAIL PROTECTED] Sent: Monday, November 22, 2004 9:47 AM To: JRun-Talk Subject: SV: Is it possible to see session timeout in the servlet? Thank you so much for your help, Jeffrey! What you wrote sounds good, but I'm afraid that I still don't quite understand. You wrote: >So if you get the session time from the servlet config, which makes me think that the information I'm looking for is somewhere in ServletConfig, but honestly I have looked at it and I don't find anywhere I can ask for the session timeout ... If you would please elaborate just a little bit on how to get the session time I would be most grateful. It sounds as if you are referring to something obvious and I can't see it and I'm beginning to feel a bit stupid about this ... :/ About your solution - it might very well be that what you write is better than my solution and I will take it up with my boss. :) Thanks! All the best, Anne-Li -----Original Message----- From: Anne-Li Mell [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 7:19 AM To: JRun-Talk Subject: SV: Is it possible to see session timeout in the servlet? Oh, just to explain; this isn't exactly what I wrote in my last mail; I wrote of warning prior to logging out then; that is part of it too - that my boss wants instead of logging out give warning and only after a bit longer, then log out. :) Sorry, forgot it below because I'm in such a hurry. Now I really must run. :D All the best, Anne-Li -----Ursprungligt meddelande----- Fran: Anne-Li Mell [mailto:[EMAIL PROTECTED] Skickat: den 19 november 2004 15:16 Till: JRun-Talk Amne: SV: Is it possible to see session timeout in the servlet? >If you do a few web searches you should come up with something you want... I tried. Though, granted, English is not my native language and maybe I'm searching for the wrong words ... :) Thanks for helping me! However, the page you sent didn't help me. I know of the HttpListeners and such, but as far as I understand them they can't help me. I think I might not have explained everything well enough in my last mail, sorry! I'm not very good at explaining and I have to leave *very soon*, but I'll try again and forgive me if this is a bit short or garbled ... :/ I need some information that is in the session, but not when the session *itself* dies (when the httplistener would get notified of the session dying), but when the user tries to do something else (later on) and by doing so will be made aware of that (s)he was logged out. For instance my program has several languages and several ways of being logged in. I have this information in the session, but it disappears when the session dies. However, I want to keep this information for when the user tries to do something new so that (s)he will keep her language and name and such. I have before saved this as hidden inputs on the html-pages, but now the information is getting to be too much and it isn't working for me. What I want is to do the logging out myself (so that I have all the information still in the session), but still log out the user if there has been no action within the time that normally would have gotten them logged out automatically by the session dying and there not being an old session for them when they try to do something new. This I hope to be able to do by keeping the session constantly alive by letting a small html-page (ticker) post itself at regular intervals (that necessarily must be shorter than the set logouttime of the JRun session (or else the session might die in the meanwhile ...)). When the user actually does something "real" I will save the timestamp of when (s)he did it. Then when the ticker post itself I will check if too long time has passed since the user did anything "for real" and, if so, log out the person, but with the right information regarding languages/names/way of being logged in as to give the proper information in the right way to the user. But to do this I need to know the length of the session so that the ticker can tick maybe twice in that time or something. :) All the best, Anne-Li http://livedocs.macromedia.com/jrun/4/Programmers_Guide/servletlifecycleeven ts4.htm Took me 3 minutes after a google search and it came up. Sorry if it's not directly answering your question. I think what you are looking for is a result of using the HttpSession object. Search the docs...I'm sure it's in there somewhere. -----Original Message----- From: Anne-Li Mell [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 2:22 AM To: JRun-Talk Subject: Is it possible to see session timeout in the servlet? I've tried to look around, but I just can't find this. Can I somehow inside the servlet see how long time has been set to session timeout? My boss wants a system that warns prior to logging out and I'm working on something that will "tick" the server (and by doing so always keep the session alive) but I need to know how long the session is set to be alive (if it doesn't gets accessed) so I can do the "timeouting" myself. We're thinking of sending it with as an init argument if it can't be accessed, but that feels not so good as then the administrators will have two places to change if they want to change the timeout-time ... Any ideas? All the best, Anne-Li Mell ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:8:5606 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/8 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:8 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.8 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
