Re: How to Logout
Hi Paul Thanks, I was able to fix this using your idea, even though I couldn't do this in the link itself since this URL is called from a lot of places. Thanks again Matt On 18.07.2012 19:06, Paul Bors wrote: There is no need to throw a RestartResponseAtInterceptPageException. Simply redirect the user to the log-in page: // Logout Link logout = new Link("logout") { @Override public void onClick() { Session.session().invalidateNow(); setResponsePage(LoginPage.class); } }; ~ Thank you, Paul Bors -Original Message- From: Sébastien Gautrin [mailto:sgaut...@telemetris.com] Sent: Wednesday, July 18, 2012 12:43 PM To: users@wicket.apache.org Subject: Re: How to Logout Hi, The LogoutPage in the application I work on is quite simple: - first we invalidate the session with session.invalidateNow() like you do - second we throw a RestartResponseAtInterceptPageException with the Page we want the user to go to after the logout process (actually we use it with the class of the Page we want, but you can pass it an instance of a Page). Hope this will help. Original Message -------- Subject: How to Logout From: Matthias Keller To: users@wicket.apache.org Date: 2012-07-18 Hi I'm trying to implement a simple logout mechanism with the need of complete session termination. For this I created a LogoutPage and mounted it using mountPage("/logout", LogoutPage.class); Now this page contains multiple components and a link to change langugage etc, therefore it is stateful. But when I perform a session.invalidate(Now)() in the page's constructor, the user gets redirected to /logout?0 with a new session ID. Probably though the page was stored in the previous session so it doesn't exist with the new one, then he gets redirected back to /logout, back to /logout?0 and so on. What do I have to do to implement this simple logout page? Thanks Matt - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- matthias.kel...@ergon.ch +41 44 268 83 98 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch __ e r g o nsmart people - smart software smime.p7s Description: S/MIME Cryptographic Signature
RE: How to Logout
There is no need to throw a RestartResponseAtInterceptPageException. Simply redirect the user to the log-in page: // Logout Link logout = new Link("logout") { @Override public void onClick() { Session.session().invalidateNow(); setResponsePage(LoginPage.class); } }; ~ Thank you, Paul Bors -Original Message- From: Sébastien Gautrin [mailto:sgaut...@telemetris.com] Sent: Wednesday, July 18, 2012 12:43 PM To: users@wicket.apache.org Subject: Re: How to Logout Hi, The LogoutPage in the application I work on is quite simple: - first we invalidate the session with session.invalidateNow() like you do - second we throw a RestartResponseAtInterceptPageException with the Page we want the user to go to after the logout process (actually we use it with the class of the Page we want, but you can pass it an instance of a Page). Hope this will help. Original Message Subject: How to Logout From: Matthias Keller To: users@wicket.apache.org Date: 2012-07-18 > Hi > > I'm trying to implement a simple logout mechanism with the need of > complete session termination. > > For this I created a LogoutPage and mounted it using > mountPage("/logout", LogoutPage.class); > > Now this page contains multiple components and a link to change > langugage etc, therefore it is stateful. > But when I perform a session.invalidate(Now)() in the page's > constructor, the user gets redirected to /logout?0 with a new session > ID. Probably though the page was stored in the previous session so it > doesn't exist with the new one, then he gets redirected back to > /logout, back to /logout?0 and so on. > > What do I have to do to implement this simple logout page? > > Thanks > > Matt > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to Logout
Hi, The LogoutPage in the application I work on is quite simple: - first we invalidate the session with session.invalidateNow() like you do - second we throw a RestartResponseAtInterceptPageException with the Page we want the user to go to after the logout process (actually we use it with the class of the Page we want, but you can pass it an instance of a Page). Hope this will help. Original Message Subject: How to Logout From: Matthias Keller To: users@wicket.apache.org Date: 2012-07-18 Hi I'm trying to implement a simple logout mechanism with the need of complete session termination. For this I created a LogoutPage and mounted it using mountPage("/logout", LogoutPage.class); Now this page contains multiple components and a link to change langugage etc, therefore it is stateful. But when I perform a session.invalidate(Now)() in the page's constructor, the user gets redirected to /logout?0 with a new session ID. Probably though the page was stored in the previous session so it doesn't exist with the new one, then he gets redirected back to /logout, back to /logout?0 and so on. What do I have to do to implement this simple logout page? Thanks Matt - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to Logout
Hi I'm trying to implement a simple logout mechanism with the need of complete session termination. For this I created a LogoutPage and mounted it using mountPage("/logout", LogoutPage.class); Now this page contains multiple components and a link to change langugage etc, therefore it is stateful. But when I perform a session.invalidate(Now)() in the page's constructor, the user gets redirected to /logout?0 with a new session ID. Probably though the page was stored in the previous session so it doesn't exist with the new one, then he gets redirected back to /logout, back to /logout?0 and so on. What do I have to do to implement this simple logout page? Thanks Matt smime.p7s Description: S/MIME Cryptographic Signature
Re: error handling and redirect (was: how to logout and redirect)
It mainly depends on whether you would like to allow a refresh, and how sensitive you are to nice URLs. The key difference is that the user will see that he/she lands on another URL when you called setRedirect(true). After that a refresh will reload the error page. With redirect set to false, the user can try the original URL again. Regards, Erik. m_salman wrote: Thanks for your reply. Since I don't have much understanding of these things -- I am a kicking and screaming web GUI developer, can you please tell me if I should use the redirect command for my error handling code. Really appreciate your help. jwcarman wrote: The setRedirect(true) call tells Wicket to use the Servlet API to issue a redirect to go to the response page as opposed to just streaming it back as the response to the current request. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logout and redirect
Thanks for your reply. Since I don't have much understanding of these things -- I am a kicking and screaming web GUI developer, can you please tell me if I should use the redirect command for my error handling code. Really appreciate your help. jwcarman wrote: > > The setRedirect(true) call tells Wicket to use the Servlet API to > issue a redirect to go to the response page as opposed to just > streaming it back as the response to the current request. > > -- View this message in context: http://www.nabble.com/how-to-logout-and-redirect-tp14878923p19543773.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logout and redirect
The setRedirect(true) call tells Wicket to use the Servlet API to issue a redirect to go to the response page as opposed to just streaming it back as the response to the current request. On Wed, Sep 17, 2008 at 7:45 PM, m_salman <[EMAIL PROTECTED]> wrote: > > I am not sure what the getrequestcycle().setredirect(true); is for. > Can you please explain that a little bit. Why can't I just set the response > page. > > Is that something special for logouts? > > > Do I need to use 'setRedirect(true)' for th following also? > > catch (ApplicationException ae) > { > setResponsePage(new ErrorPage(ae)); > } > > > Thanks. Appreciate your help. > > > igor.vaynberg wrote: >> >> almost but not quiet >> >> onclick() { getsession().invalidate(); >> getrequestcycle().setredirect(true); setresponsepage(somepage.class); >> } >> >> -igor >> >> > > -- > View this message in context: > http://www.nabble.com/how-to-logout-and-redirect-tp14878923p19543431.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logout and redirect
I am not sure what the getrequestcycle().setredirect(true); is for. Can you please explain that a little bit. Why can't I just set the response page. Is that something special for logouts? Do I need to use 'setRedirect(true)' for th following also? catch (ApplicationException ae) { setResponsePage(new ErrorPage(ae)); } Thanks. Appreciate your help. igor.vaynberg wrote: > > almost but not quiet > > onclick() { getsession().invalidate(); > getrequestcycle().setredirect(true); setresponsepage(somepage.class); > } > > -igor > > -- View this message in context: http://www.nabble.com/how-to-logout-and-redirect-tp14878923p19543431.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to logout and redirect
Add/Edit if necessary http://cwiki.apache.org/confluence/x/FSMB -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 12:06 PM To: users@wicket.apache.org Subject: Re: how to logout and redirect almost but not quiet onclick() { getsession().invalidate(); getrequestcycle().setredirect(true); setresponsepage(somepage.class); } -igor On Jan 16, 2008 3:28 AM, wicket user <[EMAIL PROTECTED]> wrote: > do you really need a Logout page > can't you do some thing like > > > Link logoutLink = new Link("logoutLink") > { > private static final long serialVersionUID = 1L; > > public void onClick() > { > session.invalidateNow(); > setResponsePage(WhereEverYouWantToRedirect.class); > } > }; > > Regards > Dipu > > > On Jan 16, 2008 11:22 AM, <[EMAIL PROTECTED]> wrote: > > > Hi: > > I used the following for logout > > Logout extend WebPage{ > > getSession().invalidateNow() > > getResponse().redirect(".") > > > > When the link is clicked, it says > > Already redirecting to "." Cannot redirect more than once > > > > What would be the solution. (interestingly, the above worked > > a while ago) Now I am using 1.3 final. > > > > BTW, I tried adding a button inside a form and use onSubmit callback > > instead of the normal submit type. The button does not respond at all > > and the html code shows there is not any way that the browser would > > send back request. > > > > in Java new button(){onSubmit()) > > > > A lot of surprises once getting into more in Wicket > > > > Thanks > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logout and redirect
almost but not quiet onclick() { getsession().invalidate(); getrequestcycle().setredirect(true); setresponsepage(somepage.class); } -igor On Jan 16, 2008 3:28 AM, wicket user <[EMAIL PROTECTED]> wrote: > do you really need a Logout page > can't you do some thing like > > > Link logoutLink = new Link("logoutLink") > { > private static final long serialVersionUID = 1L; > > public void onClick() > { > session.invalidateNow(); > setResponsePage(WhereEverYouWantToRedirect.class); > } > }; > > Regards > Dipu > > > On Jan 16, 2008 11:22 AM, <[EMAIL PROTECTED]> wrote: > > > Hi: > > I used the following for logout > > Logout extend WebPage{ > > getSession().invalidateNow() > > getResponse().redirect(".") > > > > When the link is clicked, it says > > Already redirecting to "." Cannot redirect more than once > > > > What would be the solution. (interestingly, the above worked > > a while ago) Now I am using 1.3 final. > > > > BTW, I tried adding a button inside a form and use onSubmit callback > > instead of the normal submit type. The button does not respond at all > > and the html code shows there is not any way that the browser would > > send back request. > > > > in Java new button(){onSubmit()) > > > > A lot of surprises once getting into more in Wicket > > > > Thanks > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logout and redirect
do you really need a Logout page can't you do some thing like Link logoutLink = new Link("logoutLink") { private static final long serialVersionUID = 1L; public void onClick() { session.invalidateNow(); setResponsePage(WhereEverYouWantToRedirect.class); } }; Regards Dipu On Jan 16, 2008 11:22 AM, <[EMAIL PROTECTED]> wrote: > Hi: > I used the following for logout > Logout extend WebPage{ > getSession().invalidateNow() > getResponse().redirect(".") > > When the link is clicked, it says > Already redirecting to "." Cannot redirect more than once > > What would be the solution. (interestingly, the above worked > a while ago) Now I am using 1.3 final. > > BTW, I tried adding a button inside a form and use onSubmit callback > instead of the normal submit type. The button does not respond at all > and the html code shows there is not any way that the browser would > send back request. > > in Java new button(){onSubmit()) > > A lot of surprises once getting into more in Wicket > > Thanks
Re: how to logout and redirect
try using invalidate() instead of invalidateNow Maurice On Jan 16, 2008 12:22 PM, <[EMAIL PROTECTED]> wrote: > Hi: > I used the following for logout > Logout extend WebPage{ > getSession().invalidateNow() > getResponse().redirect(".") > > When the link is clicked, it says > Already redirecting to "." Cannot redirect more than once > > What would be the solution. (interestingly, the above worked > a while ago) Now I am using 1.3 final. > > BTW, I tried adding a button inside a form and use onSubmit callback > instead of the normal submit type. The button does not respond at all > and the html code shows there is not any way that the browser would > send back request. > > in Java new button(){onSubmit()) > > A lot of surprises once getting into more in Wicket > > Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to logout and redirect
Hi: I used the following for logout Logout extend WebPage{ getSession().invalidateNow() getResponse().redirect(".") When the link is clicked, it says Already redirecting to "." Cannot redirect more than once What would be the solution. (interestingly, the above worked a while ago) Now I am using 1.3 final. BTW, I tried adding a button inside a form and use onSubmit callback instead of the normal submit type. The button does not respond at all and the html code shows there is not any way that the browser would send back request. in Java new button(){onSubmit()) A lot of surprises once getting into more in Wicket Thanks