You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by pieter claassen <pi...@claassen.co.uk> on 2009/07/23 11:36:42 UTC

redirectToInterceptPage doesn't work constructor

What is the correct way to redirect to a login page from within a
constructor. This is wicket  1.3.5 and the code below just doesn't redirect.
All my pages inherit from AuthPage().

 public AuthPage() {
        super();
        add(new MainMenuPanel("mainmenu", this));
        add(new FeedbackPanel("feedback"));
        if (getUser() == null) {
            redirectToInterceptPage(new LoginPage());
        } else {
            authorized();
            add(new UserAdminPanel("adminpanel"));
        }
    }

-- 
Pieter Claassen
musmato.com

Re: redirectToInterceptPage doesn't work constructor

Posted by pieter claassen <pi...@gmail.com>.
Thanks Martijn. This worked best:

throw new RestartResponseAtInterceptPageException(LoginPage.class);

P

On Thu, Jul 23, 2009 at 12:41 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> throw new Redirect.....Exception() instead
>
> Martijn
>
> On Thu, Jul 23, 2009 at 11:44 AM, pieter claassen<pi...@claassen.co.uk>
> wrote:
> > Sorry, I sound illiterate to myself here. To start again, it seems that I
> > cannot get redirectToInterceptPage to work correctly in my constructor
> for
> > the AuthPage class which all my pages inherit from.
> >
> > Any ideas on how to do this? I find using requestcycle's redirecTo to
> tell
> > me that I can only redirect a page once. Anyhow, I am sure that
> redirectTo
> > will not remember the redirector URL.
> >
> > Thanks
> > Pieter
> >
> > On Thu, Jul 23, 2009 at 11:36 AM, pieter claassen <pieter@claassen.co.uk
> >wrote:
> >
> >> What is the correct way to redirect to a login page from within a
> >> constructor. This is wicket  1.3.5 and the code below just doesn't
> redirect.
> >> All my pages inherit from AuthPage().
> >>
> >>  public AuthPage() {
> >>         super();
> >>         add(new MainMenuPanel("mainmenu", this));
> >>         add(new FeedbackPanel("feedback"));
> >>         if (getUser() == null) {
> >>             redirectToInterceptPage(new LoginPage());
> >>         } else {
> >>             authorized();
> >>             add(new UserAdminPanel("adminpanel"));
> >>         }
> >>     }
> >>
> >> --
> >> Pieter Claassen
> >> musmato.com
> >>
> >
> >
> >
> > --
> > Pieter Claassen
> > musmato.com
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pieter Claassen
musmato.com

Re: redirectToInterceptPage doesn't work constructor

Posted by Martijn Dashorst <ma...@gmail.com>.
throw new Redirect.....Exception() instead

Martijn

On Thu, Jul 23, 2009 at 11:44 AM, pieter claassen<pi...@claassen.co.uk> wrote:
> Sorry, I sound illiterate to myself here. To start again, it seems that I
> cannot get redirectToInterceptPage to work correctly in my constructor for
> the AuthPage class which all my pages inherit from.
>
> Any ideas on how to do this? I find using requestcycle's redirecTo to tell
> me that I can only redirect a page once. Anyhow, I am sure that redirectTo
> will not remember the redirector URL.
>
> Thanks
> Pieter
>
> On Thu, Jul 23, 2009 at 11:36 AM, pieter claassen <pi...@claassen.co.uk>wrote:
>
>> What is the correct way to redirect to a login page from within a
>> constructor. This is wicket  1.3.5 and the code below just doesn't redirect.
>> All my pages inherit from AuthPage().
>>
>>  public AuthPage() {
>>         super();
>>         add(new MainMenuPanel("mainmenu", this));
>>         add(new FeedbackPanel("feedback"));
>>         if (getUser() == null) {
>>             redirectToInterceptPage(new LoginPage());
>>         } else {
>>             authorized();
>>             add(new UserAdminPanel("adminpanel"));
>>         }
>>     }
>>
>> --
>> Pieter Claassen
>> musmato.com
>>
>
>
>
> --
> Pieter Claassen
> musmato.com
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: redirectToInterceptPage doesn't work constructor

Posted by pieter claassen <pi...@claassen.co.uk>.
Sorry, I sound illiterate to myself here. To start again, it seems that I
cannot get redirectToInterceptPage to work correctly in my constructor for
the AuthPage class which all my pages inherit from.

Any ideas on how to do this? I find using requestcycle's redirecTo to tell
me that I can only redirect a page once. Anyhow, I am sure that redirectTo
will not remember the redirector URL.

Thanks
Pieter

On Thu, Jul 23, 2009 at 11:36 AM, pieter claassen <pi...@claassen.co.uk>wrote:

> What is the correct way to redirect to a login page from within a
> constructor. This is wicket  1.3.5 and the code below just doesn't redirect.
> All my pages inherit from AuthPage().
>
>  public AuthPage() {
>         super();
>         add(new MainMenuPanel("mainmenu", this));
>         add(new FeedbackPanel("feedback"));
>         if (getUser() == null) {
>             redirectToInterceptPage(new LoginPage());
>         } else {
>             authorized();
>             add(new UserAdminPanel("adminpanel"));
>         }
>     }
>
> --
> Pieter Claassen
> musmato.com
>



-- 
Pieter Claassen
musmato.com