This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session timeout" Watch "Session timeout" New topic

Session timeout

Ankit Doshi
Ranch Hand

Joined: Dec 04, 2002
Posts: 222
If i've defined session timeout parameters at three different places:

1. In web.xml file
2. In the application - through HttpSession.setMaxInactiveInternal...
3. In the Web Server console (if the web server supports)

Which one of the above three will take precedence?
prash patil
Ranch Hand

Joined: May 26, 2008
Posts: 40
Hi Ankit,
Please find the link..if it can satisfy your question.
HTTP Session time-out Override Precedence Summary
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 225


Nice info.

Will it be applicable for all other servers also(Weblogic,Jboss etc).

Baseet Ahmed
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Originally posted by Baseet Ahmed:

Nice info.

Will it be applicable for all other servers also(Weblogic,Jboss etc).

Baseet Ahmed

web.xml is a J2EE spec and it should be followed by all containers that want to call themselves J2EE compliant

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
syed mashadi

Joined: Jun 06, 2008
Posts: 8
[Edit: thread hijack removed. Please ask new questions in new topics]
[ June 07, 2008: Message edited by: Bear Bibeault ]
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Nice link. It clearly answers the question. In summary, following is the order of precedence from low to high.

1.Timout specified for the web/application server
2.Timeout specified in web.xml
3.Timeout set in code using setMaxInactiveInterval

The reason behind this is that the timeout specified at more granular level is given higher precedence.
Any J2EE compliant server should follow the above.

Thanks and Regards
subject: Session timeout
It's not a secret anymore!