shinynewbike
shinynewbike

Reputation: 2352

Different session timeouts for different users in same web app

I have a requirement within the same web application to set 2 session timeouts.

60 minutes for regular users and 3 hours for admin users.

I am told this is not possible and I will need to host a separate web app for the admins.

Is there any workaround?

UPDATE: Thanks to Bozho and Kurt's replies - I have a followup question.

Does session.setMaxInactiveInterval() override the value of session timeout set via web.xml ?

Upvotes: 8

Views: 2448

Answers (2)

Bozho
Bozho

Reputation: 597016

You can try session.setMaxInactiveInterval(int interval)

Upvotes: 8

Kurt Du Bois
Kurt Du Bois

Reputation: 7655

When I look at the HttpSession interface, I see the following method.

setMaxInactiveInterval(int interval): Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.

Upvotes: 4

Related Questions