java - "Temporarily" set session timeout for method - setMaxInactiveInterval -
in web application user can call long running backend service (synchronous request). execution time service should not count websession timeout in code tried:
handleuserrequest() { httpsession session = ...getsession(false); int oldmaxinactiveinterval = session.getmaxinactiveinterval(); session.setmaxinactiveinterval(big_value); <long running task> session.setmaxinactiveinterval(oldmaxinactiveinterval); }
this not working expected. temporary session timeout not recognized "method call". user session times out according oldmaxinactiveinterval value.
is possible do, want do? ;-)
if oldmaxinactiveinterval
defaultsession-timeout defined in web.xml example 60. means it's 60 minutes. when set using session#setmaxinactiveinterval()
in second(1 mimnute)
it sets default session timeout web app
<session-config> <session-timeout>60</session-timeout> // 60 minutes </session-config>
calling session.setmaxinactiveinterval()
sets timeout particular session called on, , overrides default.
remember difference, - deployment descriptor
version uses minutes, , session.setmaxinactiveinterval()
uses seconds.
session.setmaxinactiveinterval(300); // sets 5 minutes
Comments
Post a Comment