Spring MVC redirect to page with custom parameter when session expired -


i can not find solutions spring redirect page parameters when session timed out. need redirect login page error "session expired". have tried filter , method session.isnew(). not work since when request reaches login page has session. httpsessionevent handler not work because not allow access request attributes , redirect page.

the easiest way create interceptor adds refresh header every response time after session expiry.

public class refreshinterceptor extends handlerinterceptoradapter {      @override     public void posthandle (         httpservletrequest request,          httpservletresponse response,          object handler,          modelandview modelandview     ) throws exception {        //if session != null , user authenticated then...       response.setintheader("refresh", figureoutwhensessionexpires() + a_small_delay );        super.posthandle(request, response, handler, modelandview);      } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -