This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm on this problem for all day and I must be totally idiot, because I don't know solution
In aplication session timeout is setted to 30 minutes. Question is HOW can I detect session timeout in Filter? I have to detect it when user perform some server-action but before bean method is called. I'm using filter, because I have to send customized ServletResponse to client when session timeout is detected.
Is there any solution? I'm really lost
Thanks and sorry for my bad english...
You do have access to HttpServletRequest in your filter, from which you can get the session. Once you have the session, you can check it how long it is been inactive and take action accoridingly. Is this what you are looking for ?
In aplication session timeout is setted to 30 minutes. Question is HOW can I detect session timeout in Filter?
Are you asking how to detect if the session has timed out? A call to request.getSession(false) would return a null value in that case.
Joined: Jan 30, 2010
Thanks for replies.
I tried request.getSession(false) , but it always returns session object. I tried change filters order witn no effect. Whenever session for client timeouted and I tried to contact server, HttpServletRequest holds new session. What now? This filter is first in web.xml so I think it coudn't by affected by any other in filter pipeline.
Or is there something in web.xml I have to define?