aspose file tools
The moose likes Servlets and the fly likes Variable session timout Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Variable session timout " Watch "Variable session timout " New topic
Author

Variable session timout

S Bhanu
Greenhorn

Joined: Feb 28, 2005
Posts: 15
We are facing a problem with session timeout. As per requirement we need to have different timeout values for different pages. i.e. to say 40 min for page A and 45 min for page B. Is there any way this configuration can be done. We are using Weblogic9/Java5/Struts1.1.

If you feel this is not the right forum for the question, please let me know.

Thanks!
Bshar
[ August 11, 2006: Message edited by: Bshar ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Moving to the Servlets forum.
[ August 11, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Bshar,

We're glad you dropped by the Java Ranch. There aren't many rules here, but we do ask that you let us know who you are by giving us your actual first and last names. Please make sure the "publicly displayed name" in your profile meets the JavaRanch naming policy.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You can change it at runtime but changing one page will affect them all.
There is only one session object per session.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
S Bhanu
Greenhorn

Joined: Feb 28, 2005
Posts: 15
Thanks, Ben.

I looked into your solution. It works fine

Is it possible to achieve this functionality through some configuration i.e. by putting into an xml file or something so that it can be changed by support team as well. I would not like the jars to be recompiled everytime I make such a change. Any ssuggestions?

Thank you!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Bshar,

Our naming policy is not optional.
Please use the link provided by Merrill to fix your screenname.

Accounts with invalid names are subject to deletion.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

The session timeout settings in the deployment descriptor are for all pages, not for page A or B. You'll have to make your own configuration file if needed.


[My Blog]
All roads lead to JavaRanch
S Bhanu
Greenhorn

Joined: Feb 28, 2005
Posts: 15
Dear Ben,
I respect JavaRanch's naming policy and have edited my profile accordingly. I do not know why the chages are not reflecting in my posts!
Regards
Originally posted by Ben Souther:
Bshar,

Our naming policy is not optional.
Please use the link provided by Merrill to fix your screenname.

Accounts with invalid names are subject to deletion.
Rusty Smythe
Ranch Hand

Joined: Aug 09, 2006
Posts: 93
Try HttpSession.getMaxInactiveInterval()
S Bhanu
Greenhorn

Joined: Feb 28, 2005
Posts: 15
Thanks for your inputs. I am using HttpSession.getMaxInactiveInterval() now. Any further suggestions are welcome.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Sharma Bhanu:
Dear Ben,
I respect JavaRanch's naming policy and have edited my profile accordingly. I do not know why the chages are not reflecting in my posts!
Regards

It gets updated the next time someone writes to it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56185
    
  13

If you want a per-page timeout, you will have to do it with some other mechanism besides the session -- probably JavaScript timers on the various pages.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Variable session timout
 
Similar Threads
redirect after timeout
Session Expiration Doubt - 1
Session timeout in struts
Session Problem
Siteminder Timeout Overriding Weblogic Timeout