I have designed a code of SessionFilter in jsp Spring application and i kept 5 minutes of Session timeout period. I want to display a confirmation message to user before 30 seconds of timeout saying "Your Session is going to expire in another 30 Second. Do you want to continue." If user clicks Cancel button, the flow has to navigate to Login page and if the user clicks OK button, the page should stay in same page keeping session variable alive.
var timeLeft = confirm('Your Session is going to expire in another 30 Second. Do you want to continue.');
if(timeLeft == true)
window.location = self.location.reload(true);