Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

How to keep the session alive, when web app is inactive?

Thread view: 
aneta737@yahoo.com - 03 Jan 2006 18:24 GMT
Hello,

I have a web (Struts based) application which holds almost all info
about what user is logged in and what he was currently doing in a
session.

Once the session expires, all info is lost and users get errors... so
they have to re-open the application and re-login.

I have a Websphere timeout set to 30 mins (I can't change that).  What
can I do to keep the session ALIVE when the user is not using the
application?

I have heard of Socket.keepAlive(true) method.  Would that work for me?

Any help would be appreciated.
Comics - 03 Jan 2006 18:26 GMT
Can't change timeout in Web.xml?
So, use "timer/thread" to put something into session in certain interval.

> Hello,
>
[quoted text clipped - 12 lines]
>
> Any help would be appreciated.
aneta737@yahoo.com - 03 Jan 2006 20:00 GMT
Actually, my application is using a common company API that controls
the login.  I believe there are other INACTIVE settings that kill my
session.

What can I do to "pretent" that someone is working on the application,
i.e. gets or sends requests to/from the server.

I've read that Socket.keepAlive(true) will send the packet only after 2
hours.  Is there something like that I could implement but I need to
send packets more often (less than 30 min)?
Abhijat Vatsyayan - 03 Jan 2006 21:02 GMT
What is wrong with method "setMaxInactiveInterval" ? This should
override any timeout specified in web.xml .

Abhijat

> Hello,
>
[quoted text clipped - 12 lines]
>
> Any help would be appreciated.
Bruce Lewis - 03 Jan 2006 21:18 GMT
> I have a web (Struts based) application which holds almost all info
> about what user is logged in and what he was currently doing in a
> session.

That's precisely your problem.  The only info that should ever go in a
session variable is info that can be easily reconstructed or info you
don't care about.

Your login system should be able to reauthenticate a user no matter what
they're doing.

Info about what a user is currently doing belongs in URLs or hidden form
variables.  The side that cares about the info is the one that should
keep it.

There's a reason why statelessness on the server side is one of the
bragging points of HTTP.

Signature

http://ourdoings.com/         Easily organize and disseminate news and
                             photos for your family or group.

isamura - 04 Jan 2006 00:56 GMT
: Hello,
:
[quoted text clipped - 8 lines]
: can I do to keep the session ALIVE when the user is not using the
: application?

One approach may be provide a link to a keepSessionAlive.jsp page where the page automatically
refreshes at regular interval. Of course this page will have to "live" in a separate tab or window.

.k
Robert - 04 Jan 2006 02:22 GMT
I second isamura.  We use the XMLHttpRequest to keep the app in
constant contact with the server, about every minute or so as long as
the window stays open.  As soon as someone closes the app they drop
their session but if they leave the window open all day and don't log
out their session lives on and they can come back to it whenever.  The
only time this is a problem is when the users do a task that takes a
long time for a page refresh and it occassionally times out.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.