So what can I do in my case? Is there another possibility to react on a session Timeput and redirection of the user?
Regards, Andy -----Ursprüngliche Nachricht----- Von: Matthias Wessendorf [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Februar 2006 14:41 An: MyFaces Discussion Betreff: Re: HttpSessionListener -->How to react, when Session is not valid anymore Hi Andreas, for each request there is one FacesContext obj, so it is not associated to the user's (http) session. -Matthias On 2/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi! > > I have just implemented a HttpSessionListener to react on the event, when > the session is not valid anymore. > > Now I want to redirect the user to my login page again, when the session is > timed out... > > The Problem is, that the FacesContext is also null, when the session is > timed out... > So how can I do a redirect, if I don't have a FacesContext? > > > So my listener looks like this: > public final class MyContextListener implements HttpSessionListener { > > public void sessionCreated(HttpSessionEvent arg0) { > // TODO Auto-generated method stub > > } > > public void sessionDestroyed(HttpSessionEvent arg0) { > System.out.println("SESSION ABGELAUFEN"); > > HttpServletRequest req = (HttpServletRequest) > FacesContext.getCurrentInstance().getExternalContext().getRequest(); > > HttpServletResponse res > =(HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse(); > > > try { > req.getRequestDispatcher("/logout.jsp").forward(req, > res); > } > catch (ServletException e2) { > e2.printStackTrace(); > } catch (IOException e2) { > e2.printStackTrace(); > } > } > } > ______________________________________________________________________ > Diese Nachricht ist fuer die MAGNA STEYR Fahrzeugtechnik AG & Co KG > rechtsunverbindlich! - This message is not legally binding upon MAGNA STEYR > Fahrzeugtechnik AG & Co KG! This email and any files transmitted with it are > confidential and intended solely for the use of the individual or entity to > whom they are addressed. If you have received this email in error please > notify your system manager. This footnote also confirms that this email > message has been swept for the presence of computer viruses. > ______________________________________________________________________ > -- Matthias Wessendorf Zülpicher Wall 12, 239 50674 Köln http://www.wessendorf.net mwessendorf-at-gmail-dot-com ______________________________________________________________________ Diese Nachricht ist fuer die MAGNA STEYR Fahrzeugtechnik AG & Co KG rechtsunverbindlich! - This message is not legally binding upon MAGNA STEYR Fahrzeugtechnik AG & Co KG! This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify your system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. ______________________________________________________________________

