You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthias Keller <ma...@ergon.ch> on 2012/07/18 18:26:36 UTC
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
Re: How to Logout
Posted by Matthias Keller <ma...@ergon.ch>.
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:sgautrin@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 <ma...@ergon.ch>
> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
matthias.keller@ergon.ch +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
______________________________________________________________
e r g o n smart people - smart software
RE: How to Logout
Posted by Paul Bors <pb...@knoa.com>.
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:sgautrin@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 <ma...@ergon.ch>
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to Logout
Posted by Sébastien Gautrin <sg...@telemetris.com>.
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 <ma...@ergon.ch>
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org