Solved

Setting session timeout dynamically in Java code

Posted on 2009-04-10
3
1,508 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sourc…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

622 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