You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by me...@investorservicing.natixis.fr on 2007/10/08 17:47:29 UTC

session expired

I'd like to write an interceptor that will redirect
to a page when the session is expired.

I know that I can acces  to the session in the interceptor like that.

public String intercept(ActionInvocation invocation) throws Exception
        {
        Map session = invocation.getInvocationContext().getSession();
           }

but I don't know how to test the validity of the session within the 
intercept method.

the request.isRequestedSessionIdValid() upon the HttpServletRequest 
returns a boolean which
tell me if the session is valid. But I don't know how to access to the 
HttpServletRequest  within an interceptor.

If someone has an idea about that.

Meissa

L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.

Re: session expired

Posted by st...@gmail.com.
Once you obtain the Http* objects from Action, life should be the same as it
always was!

Scott

On 10/9/07, meissa.sakho@investorservicing.natixis.fr <
meissa.sakho@investorservicing.natixis.fr> wrote:
>
>
> I have used the piece of code and it works. I can acces the
> HttpServletRequest  object.
> But the  the request.isRequestedSessionIdValid() always returns me false.
> I'm sure that the session is valid since I've put a flag object in it (the
> session) to initialize te session  in the first Action
> that is called. This action is not intercepted (to prevent the
> SessionExpiredInterceptor interceptor beeing called inside it).
>
> In struts1, calling the request.isRequestedSessionIdValid() gives me true
> when the session is valid and false when not.
>
> Why won't we have the same thing in struts2.
> How can we simply test if a session is not expired (or is valid) in
> struts2.
>
> thank in advance.
>
>
>
>
>
> "Wes Wannemacher" <we...@wantii.com>
> 08/10/2007 18:45
> Veuillez répondre à
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> A
> "Struts Users Mailing List" <us...@struts.apache.org>
> cc
>
> Objet
> Re: session expired
>
>
>
>
>
>
> You can grab the request just like they do in the ServletConfigInterceptor
> -
>
>     final Object action = invocation.getAction();
>     final ActionContext context = invocation.getInvocationContext();
>     HttpServletRequest request = (HttpServletRequest)
> context.get(HTTP_REQUEST);
>
> On 10/8/07, meissa.sakho@investorservicing.natixis.fr
> <me...@investorservicing.natixis.fr> wrote:
> >
> > I'd like to write an interceptor that will redirect
> > to a page when the session is expired.
> >
> > I know that I can acces  to the session in the interceptor like that.
> >
> > public String intercept(ActionInvocation invocation) throws Exception
> >         {
> >         Map session = invocation.getInvocationContext().getSession();
> >            }
> >
> > but I don't know how to test the validity of the session within the
> > intercept method.
> >
> > the request.isRequestedSessionIdValid() upon the HttpServletRequest
> > returns a boolean which
> > tell me if the session is valid. But I don't know how to access to the
> > HttpServletRequest  within an interceptor.
> >
> > If someone has an idea about that.
> >
> > Meissa
> >
> > L'integrite de ce message n'etant pas assuree sur internet, Natixis ne
> peut etre tenu responsable de son contenu. Toute utilisation ou diffusion
> non autorisee est interdite. Si vous n'etes pas destinataire de ce
> message, merci de le detruire et d'avertir l'expediteur.
> > Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails
> que si necessaire
> >
> > The integrity of this message cannot be guaranteed on the Internet.
> Natixis can not therefore be considered responsible for the contents. Any
> unauthorized use or dissemination is prohibited. If you are not the
> intended recipient of this message, then please delete it and notify the
> sender.
> >
>
>
> --
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> L'integrite de ce message n'etant pas assuree sur internet, Natixis ne
> peut etre tenu responsable de son contenu. Toute utilisation ou diffusion
> non autorisee est interdite. Si vous n'etes pas destinataire de ce message,
> merci de le detruire et d'avertir l'expediteur.
> Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails
> que si necessaire
>
> The integrity of this message cannot be guaranteed on the Internet.
> Natixis can not therefore be considered responsible for the contents. Any
> unauthorized use or dissemination is prohibited. If you are not the intended
> recipient of this message, then please delete it and notify the sender.
>



-- 
Scott
stanlick@gmail.com

Re: session expired

Posted by me...@investorservicing.natixis.fr.
I was wrong on my test.
It works.
Meissa



meissa.sakho@investorservicing.natixis.fr 
09/10/2007 09:41
Veuillez répondre à
"Struts Users Mailing List" <us...@struts.apache.org>


A
"Struts Users Mailing List" <us...@struts.apache.org>
cc

Objet
Re: session expired







I have used the piece of code and it works. I can acces the 
HttpServletRequest  object.
But the  the request.isRequestedSessionIdValid() always returns me false.
I'm sure that the session is valid since I've put a flag object in it (the 

session) to initialize te session  in the first Action
that is called. This action is not intercepted (to prevent the 
SessionExpiredInterceptor interceptor beeing called inside it).

In struts1, calling the request.isRequestedSessionIdValid() gives me true 
when the session is valid and false when not.

Why won't we have the same thing in struts2.
How can we simply test if a session is not expired (or is valid) in 
struts2.

thank in advance.





"Wes Wannemacher" <we...@wantii.com> 
08/10/2007 18:45
Veuillez répondre à
"Struts Users Mailing List" <us...@struts.apache.org>


A
"Struts Users Mailing List" <us...@struts.apache.org>
cc

Objet
Re: session expired






You can grab the request just like they do in the ServletConfigInterceptor 

-

    final Object action = invocation.getAction();
    final ActionContext context = invocation.getInvocationContext();
    HttpServletRequest request = (HttpServletRequest) 
context.get(HTTP_REQUEST);

On 10/8/07, meissa.sakho@investorservicing.natixis.fr
<me...@investorservicing.natixis.fr> wrote:
>
> I'd like to write an interceptor that will redirect
> to a page when the session is expired.
>
> I know that I can acces  to the session in the interceptor like that.
>
> public String intercept(ActionInvocation invocation) throws Exception
>         {
>         Map session = invocation.getInvocationContext().getSession();
>            }
>
> but I don't know how to test the validity of the session within the
> intercept method.
>
> the request.isRequestedSessionIdValid() upon the HttpServletRequest
> returns a boolean which
> tell me if the session is valid. But I don't know how to access to the
> HttpServletRequest  within an interceptor.
>
> If someone has an idea about that.
>
> Meissa
>
> L'integrite de ce message n'etant pas assuree sur internet, Natixis ne 
peut etre tenu responsable de son contenu. Toute utilisation ou diffusion 
non autorisee est interdite. Si vous n'etes pas destinataire de ce 
message, merci de le detruire et d'avertir l'expediteur.
> Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails 
que si necessaire
>
> The integrity of this message cannot be guaranteed on the Internet. 
Natixis can not therefore be considered responsible for the contents. Any 
unauthorized use or dissemination is prohibited. If you are not the 
intended recipient of this message, then please delete it and notify the 
sender.
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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




L'integrite de ce message n'etant pas assuree sur internet, Natixis ne 
peut etre tenu responsable de son contenu. Toute utilisation ou diffusion 
non autorisee est interdite. Si vous n'etes pas destinataire de ce 
message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails 
que si necessaire

The integrity of this message cannot be guaranteed on the Internet. 
Natixis can not therefore be considered responsible for the contents. Any 
unauthorized use or dissemination is prohibited. If you are not the 
intended recipient of this message, then please delete it and notify the 
sender.



L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.

Re: session expired

Posted by me...@investorservicing.natixis.fr.
I have used the piece of code and it works. I can acces the 
HttpServletRequest  object.
But the  the request.isRequestedSessionIdValid() always returns me false.
I'm sure that the session is valid since I've put a flag object in it (the 
session) to initialize te session  in the first Action
that is called. This action is not intercepted (to prevent the 
SessionExpiredInterceptor interceptor beeing called inside it).

In struts1, calling the request.isRequestedSessionIdValid() gives me true 
when the session is valid and false when not.

Why won't we have the same thing in struts2.
How can we simply test if a session is not expired (or is valid) in 
struts2.

thank in advance.





"Wes Wannemacher" <we...@wantii.com> 
08/10/2007 18:45
Veuillez répondre à
"Struts Users Mailing List" <us...@struts.apache.org>


A
"Struts Users Mailing List" <us...@struts.apache.org>
cc

Objet
Re: session expired






You can grab the request just like they do in the ServletConfigInterceptor 
-

    final Object action = invocation.getAction();
    final ActionContext context = invocation.getInvocationContext();
    HttpServletRequest request = (HttpServletRequest) 
context.get(HTTP_REQUEST);

On 10/8/07, meissa.sakho@investorservicing.natixis.fr
<me...@investorservicing.natixis.fr> wrote:
>
> I'd like to write an interceptor that will redirect
> to a page when the session is expired.
>
> I know that I can acces  to the session in the interceptor like that.
>
> public String intercept(ActionInvocation invocation) throws Exception
>         {
>         Map session = invocation.getInvocationContext().getSession();
>            }
>
> but I don't know how to test the validity of the session within the
> intercept method.
>
> the request.isRequestedSessionIdValid() upon the HttpServletRequest
> returns a boolean which
> tell me if the session is valid. But I don't know how to access to the
> HttpServletRequest  within an interceptor.
>
> If someone has an idea about that.
>
> Meissa
>
> L'integrite de ce message n'etant pas assuree sur internet, Natixis ne 
peut etre tenu responsable de son contenu. Toute utilisation ou diffusion 
non autorisee est interdite. Si vous n'etes pas destinataire de ce 
message, merci de le detruire et d'avertir l'expediteur.
> Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails 
que si necessaire
>
> The integrity of this message cannot be guaranteed on the Internet. 
Natixis can not therefore be considered responsible for the contents. Any 
unauthorized use or dissemination is prohibited. If you are not the 
intended recipient of this message, then please delete it and notify the 
sender.
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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




L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.

Re: session expired

Posted by Wes Wannemacher <we...@wantii.com>.
You can grab the request just like they do in the ServletConfigInterceptor -

    final Object action = invocation.getAction();
    final ActionContext context = invocation.getInvocationContext();
    HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);

On 10/8/07, meissa.sakho@investorservicing.natixis.fr
<me...@investorservicing.natixis.fr> wrote:
>
> I'd like to write an interceptor that will redirect
> to a page when the session is expired.
>
> I know that I can acces  to the session in the interceptor like that.
>
> public String intercept(ActionInvocation invocation) throws Exception
>         {
>         Map session = invocation.getInvocationContext().getSession();
>            }
>
> but I don't know how to test the validity of the session within the
> intercept method.
>
> the request.isRequestedSessionIdValid() upon the HttpServletRequest
> returns a boolean which
> tell me if the session is valid. But I don't know how to access to the
> HttpServletRequest  within an interceptor.
>
> If someone has an idea about that.
>
> Meissa
>
> L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur.
> Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire
>
> The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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