I was wrong on my test. It works. Meissa
[EMAIL PROTECTED] 09/10/2007 09:41 Veuillez répondre à "Struts Users Mailing List" <user@struts.apache.org> A "Struts Users Mailing List" <user@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" <[EMAIL PROTECTED]> 08/10/2007 18:45 Veuillez répondre à "Struts Users Mailing List" <user@struts.apache.org> A "Struts Users Mailing List" <user@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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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.