you can't redirect from a SessionListener as it is called by the servlet 
container and does not involve any user interaction. 

provide a Dispatcher that checks  whether your AppModule.USER_LOGGED_IN 
attribute is available from the current HttpSession; if it is not redirect 
the current request to any page

g,
kris




Von:    kamath_svk <kamath...@yahoo.co.in>
An:     users@tapestry.apache.org
Datum:  22.09.2010 08:57
Betreff:        Redirect when session is destroyed




Hi,

I found a site for session handling using Tapestry5.
http://eubauer.de/kingsware/2010/02/04/track-login-and-logout-of-users-with-tapestry-5/
 


when ever session is destroyed, sessionDestroyed() method in
SessionListener[user-defined] class which is added in services package of
tapestry is automatically called.

can any one tell me how to redirect the browser to a default page ?
if i had response object i could have redirected to some page but that
method doesn't contain response object.

i have added the code for SessionListener class.

public class SessionListener implements HttpSessionListener {
                 public void sessionCreated(HttpSessionEvent se) {
                                 // Do nothing
                 }

                 public void sessionDestroyed(HttpSessionEvent se) {
                                 System.out.println(" *      Session is 
destroyed      *  ");
                                 HttpSession session = se.getSession();
                                 Principal principal = (Principal)
session.getAttribute(AppModule.USER_LOGGED_IN);
 session.removeAttribute(AppModule.USER_LOGGED_IN);  
                                 // Do some stuff here...
                 }
}

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Redirect-when-session-is-destroyed-tp2849255p2849255.html

Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


Reply via email to