Solved

Setting session timeout dynamically in Java code

Posted on 2009-04-10
3
1,502 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
ID: 24138204
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
ID: 24138218
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
ID: 24844319
I would use session.setMaxInactiveInterval(ONE_HOUR);
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Win 7 OS unable to install Win updates 3 164
Denali Software 2 53
java stored proc example 9 29
Salesforce CPQ Steelbrick - Select All Checkbox 3 31
A list of useful business intelligence software.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

785 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