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

Discussion in 'Java' started by aneta737@yahoo.com, Jan 3, 2006.

  1. Guest

    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.
    , Jan 3, 2006
    #1
    1. Advertising

  2. Comics Guest

    Can't change timeout in Web.xml?
    So, use "timer/thread" to put something into session in certain interval.


    <> wrote in message
    news:...
    > 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, Jan 3, 2006
    #2
    1. Advertising

  3. Guest

    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)?
    , Jan 3, 2006
    #3
  4. What is wrong with method "setMaxInactiveInterval" ? This should
    override any timeout specified in web.xml .

    Abhijat

    wrote:
    > 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.
    >
    Abhijat Vatsyayan, Jan 3, 2006
    #4
  5. Bruce Lewis Guest

    writes:

    > 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.

    --

    http://ourdoings.com/ Easily organize and disseminate news and
    photos for your family or group.
    Bruce Lewis, Jan 3, 2006
    #5
  6. isamura Guest

    <> wrote ...
    : 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?
    :
    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
    isamura, Jan 4, 2006
    #6
  7. Robert Guest

    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.
    Robert, Jan 4, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luiz Alberto Gibson da Costa

    web chat development, http header connection: keep-alive

    Luiz Alberto Gibson da Costa, Aug 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    604
    Luiz Alberto Gibson da Costa
    Aug 6, 2003
  2. twscott
    Replies:
    1
    Views:
    5,038
  3. Herman

    Keep JVM alive with JNI

    Herman, May 24, 2004, in forum: Java
    Replies:
    6
    Views:
    1,105
    Herman
    May 27, 2004
  4. Replies:
    0
    Views:
    103
  5. hisan
    Replies:
    1
    Views:
    1,313
    Dan Stromberg
    Jun 25, 2012
Loading...

Share This Page