Re: Redirect when session is destroyed
Thiago H. de Paula Figueiredo wrote: If inside a page, check the page navigation page in the documentation. I was not referring to redirecting from page. As we know if session is expired sessionDestroyed method is called by tapestry. (Please refer the code) http://eubauer.de/kingsware/2010/02/04/track-login-and-logout-of-users-with-tapestry-5/ I was referring to a scenario wherein if session is expired user is automatically redirected to start or index page. So i was asking, how to redirect to start page from sessionDestroyed method. Thank you for the links provided, that would be really helpful to me. -- View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-Redirect-in-sessionDestroyed-method-tp2849255p2854394.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
Re: Redirect when session is destroyed
On Sun, 26 Sep 2010 11:53:44 -0300, kamath_svk kamath...@yahoo.co.in wrote: As we know if session is expired sessionDestroyed method is called by tapestry. This method is not called by Tapestry, but by the servlet container (server). (Please refer the code) http://eubauer.de/kingsware/2010/02/04/track-login-and-logout-of-users-with-tapestry-5/ I was referring to a scenario wherein if session is expired user is automatically redirected to start or index page. It's only possible to redirect when a request is made. So i was asking, how to redirect to start page from sessionDestroyed method. It's not possible. Instead, create a RequestFilter that checks if the session exists and the user is logged in, then use Redirect.sendRequest() if needed. This is similar to the approach in the URL you provided. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
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
Re: Redirect when session is destroyed
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
Re: Redirect when session is destroyed
I am new to tapestry so can you please tell me how to use dispatcher using some example?? most importantly, i want to know how to Redirect to some other page!! Kristian Marinkovic wrote: 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 -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-when-session-is-destroyed-tp2849255p2849363.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
Re: Redirect when session is destroyed
You really need to do some reading... go through the servlet api, the Tapestry docs, also the wiki: http://wiki.apache.org/tapestry/Tapestry5HowTos Then use Jumpstart which has all the hands on examples you need to feel confident with Tapestry: http://jumpstart.doublenegative.com.au/home.html Here is an article on how to create a dispatcher: http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher Redirection inside any filter or dispatcher is based upon the servlet api, Tapestry's Request service simply wraps this, using: Response.sendRedirect() Also, when you post to this list you will get a better response when you show your code. Cheers, Peter - Original Message - From: kamath_svk kamath...@yahoo.co.in To: users@tapestry.apache.org Sent: Wednesday, 22 September, 2010 11:51:44 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Redirect when session is destroyed I am new to tapestry so can you please tell me how to use dispatcher using some example?? most importantly, i want to know how to Redirect to some other page!! Kristian Marinkovic wrote: 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 -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-when-session-is-destroyed-tp2849255p2849363.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect when session is destroyed
On Wed, 22 Sep 2010 05:51:44 -0300, kamath_svk kamath...@yahoo.co.in wrote: I am new to tapestry so can you please tell me how to use dispatcher using some example?? There are many examples in this mailing list archives and in the wiki. Reading the Dispatcher JavaDoc also helps. most importantly, i want to know how to Redirect to some other page!! If inside a page, check the page navigation page in the documentation. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org