Solved

Setting session timeout dynamically in Java code

Posted on 2009-04-10
3
1,496 Views
Last Modified: 2013-12-11
Is there a way to programatically to set the session timeout in Websphere 6.1 using Java in a J2EE application?

I was able to reset the time out by adding:

<session-config>
<session-timeout>2</session-timeout>
</session-config>

to the web.xml file.

0
Comment
Question by:jwright9
3 Comments
 
LVL 41

Expert Comment

by:HonorGod
Comment Utility
To what tag did you add the session-config clause?

You should be able to do it using the JMX API.
0
 
LVL 12

Accepted Solution

by:
Gibu George earned 500 total points
Comment Utility
There is a method getLastAccessedTime() which can be used to check the time the session had been inactive and be invalidated

long inactiveTimeInMillis=System.currentTimeInMillies()-session.getLastAccessedTime();
if(inactiveTimeInMillis > <a specified time>)
  session.invalidate()
0
 

Expert Comment

by:prototypeit
Comment Utility
I would use session.setMaxInactiveInterval(ONE_HOUR);
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 59
array220 challenge 8 44
JItbit AD intergration 4 43
maven example error 3 34
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
The viewer will learn how to set up a document for the web and print and the recommended PPI for printing.
Viewers will learn how to use the Hootsuite Dashboard.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now