You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Gareth Coltman <ga...@majorband.co.uk> on 2001/06/18 11:59:32 UTC

RE: session timeout, how to know ?

Jon,

As far as I can tell, by the time a screen or action class is called the HttpSession.isNew() method will always return false due to
session attributes being set in Turbine.java. This means that is impossible to redirect someone to a "your session has expired"
screen. I have the same problem as Vincent, and have taken your advice and looked at the session object but I'm not sure what you
were talking about if not the isNew method.

What I need to do is redirect an anonymous user to a "Your session has expired" screen if their session has timed out. I could just
catch the null pointer returned by the getTemp method, but this is a bit of a hack.

Any help is much appreciated.

Gareth

>
> on 5/30/01 2:54 AM, "Vincent Chappuis" <vi...@idbsoft.ch> wrote:
>
> > OK!
> >
> > but every time I lose the session, a new session is created. How to now if
> > it is a new session(created because I lost the session) or just because this
> > is
> > the first time I hit the system ?
>
> I already told you...
>
>     "Look at the HttpSession object."
>
> You may wish to go get Jason Hunter's book on Servlets or just read the
> Servlet API. This is outside of the scope of Turbine.
>
> -jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: session timeout, how to know ?

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/19/01 2:06 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

> Thanks for your lengthy reply jon. ;) but I don't understand how your
> suggestion is possible. I don't want to check if every session
> is old, but check on a per screen basis.

That is per request basis.

> Ie. If my screen contains data that
> is not persisted, and therefore requires it to be in
> the session, I must be able to check whether the session is fresh.

No, you should check if the data you need is there.

Note: you aren't using Pull at all.

> Otherwise, 
> on pages with no data taken from the session I don't
> care whether the session has expired or not. I don't see how I could achieve
> this with a session validator.

The SessionValidator will tell you if the session exists or not. If not,
then show a session timed out screen by simply modifying the Parameter's in
the ParameterParser. That is what you originally asked for.

> I suppose I could have the sessionvalidator return false for
> requiresNewSession but I am worried about knock on effects in Turbine
> (my understanding of how Turbine handles sessions is fairly primitive as you
> can tell!)

Turbine's session handling is defined in the Servlet API. All we do is
provide hooks that allow you to modify the application state during
processing so that you can conditionally do things.

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: session timeout, how to know ?

Posted by Gareth Coltman <ga...@majorband.co.uk>.
Thanks for your lengthy reply jon. ;) but I don't understand how your suggestion is possible. I don't want to check if every session
is old, but check on a per screen basis. Ie. If my screen contains data that is not persisted, and therefore requires it to be in
the session, I must be able to check whether the session is fresh. Otherwise, on pages with no data taken from the session I don't
care whether the session has expired or not. I don't see how I could achieve this with a session validator.

I suppose I could have the sessionvalidator return false for requiresNewSession but I am worried about knock on effects in Turbine
(my understanding of how Turbine handles sessions is fairly primitive as you can tell!)

I would appreciate it if somebody could expand on Jon's original help.

Thanks a million

Gareth

> -----Original Message-----
> From: Jon Stevens [mailto:jon@latchkey.com]
> Sent: Monday, June 18, 2001 18:12
> To: Turbine-user
> Subject: Re: session timeout, how to know ?
>
>
> on 6/18/01 2:59 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:
>
> > Jon,
> >
> > As far as I can tell, by the time a screen or action class is called the
> > HttpSession.isNew() method will always return false due to
> > session attributes being set in Turbine.java. This means that is impossible to
> > redirect someone to a "your session has expired"
> > screen.
>
> It is possible.
>
> > What I need to do is redirect an anonymous user to a "Your session has
> > expired" screen if their session has timed out. I could just
> > catch the null pointer returned by the getTemp method, but this is a bit of a
> > hack.
>
> You would do this in your own SessionValidator.
>
> -jon
>
> --
> "Open source is not available to commercial companies."
>             -Steve Ballmer, CEO Microsoft
> <http://www.suntimes.com/output/tech/cst-fin-micro01.html>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: session timeout, how to know ?

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 2:59 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

> Jon,
> 
> As far as I can tell, by the time a screen or action class is called the
> HttpSession.isNew() method will always return false due to
> session attributes being set in Turbine.java. This means that is impossible to
> redirect someone to a "your session has expired"
> screen.

It is possible.

> What I need to do is redirect an anonymous user to a "Your session has
> expired" screen if their session has timed out. I could just
> catch the null pointer returned by the getTemp method, but this is a bit of a
> hack.

You would do this in your own SessionValidator.

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org