0

I have questions about HTTP session timeout in servlet API. Does it mean that after this time the session will be invalid? no matter if the user is still active in the browser? Has this attribute any relation to the session time out user get on his browser after some amount of time of inactivity?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user5157427
  • 241
  • 2
  • 7
  • 17

1 Answers1

0

Does after this time the session will be invalid ?

Yes, the session will be invalid after the timeout configured i.e., if there is no request within that time, then the server kills that user's session.

no matter if the user is still active in the browser ?

Session time out comes into play when the user does not perform any action in the browser that initiates a request to the server.

web.xml configuration:

<session-config>
    <session-timeout>1</session-timeout> <!-- in minutes -->
</session-config>

Configuring using API:

HttpSession session = request.getSession();
session.setMaxInactiveInterval(40*60);//in seconds

You can refer here for more details.

Vasu
  • 21,832
  • 11
  • 51
  • 67