Session expired in spring MVC?

For sessions timeout I am using 'plain' Servlet API.

For sessions timeout I am using 'plain' Servlet API. Custom javax.servlet.http. HttpSessionListener defined in web.

Xml and in method sessionCreated on session set timeout using setMaxInactiveInterval (in s). I know it is 'old school', but is simple and working for me. If you want to get timeout value from spring, there is access to ServletContext from session.

ApplicationContext applicationContext = WebApplicationContextUtils. GetWebApplicationContext(session. GetServletContext()); applicationContext.

GetBean("...").

Alephx, thanks for your answer. I wanted to know where in controller classes I should check it. Should I write a separate class or method to handle it and what is the best way of checking the session?

– user965884 Oct 27 at 10:29 My response was about setting own session timeout in app code. Not sure if you can check session state. Sessions are managed by container (Tomcat, etc) - if session expires it invalidate it.

You can only check if session is valid. For this you need Filter Servlet way or Spring interceptor org.springframework.web.servlet. HandlerInterceptor Spring MVC way – alephx Oct 27 at 11:07.

One option is to use the event mechanism in ApplicationContext, you would then register a HttpSessionListener in web. Xml that when a session timeouts fires an event in the root WebApplicationContext to all beans that observes that event. Get the root WebApplicationContext using WebApplicationContextUtils.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send