Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contdown on Servlet Session

I need to create a countdown on the servlet´s session to fire events when X minutes to expire...

So, there is a way to know how many seconds is remaining to finish the session?

like image 488
andolffer.joseph Avatar asked Mar 20 '13 21:03

andolffer.joseph


1 Answers

You can compute the remaining time (in seconds) using the HttpSession API:

httpSession.getMaxInactiveInterval() - ((System.currentTimeMillis() - httpSession.getLastAccessedTime())/1000
like image 107
dcernahoschi Avatar answered Nov 01 '22 00:11

dcernahoschi