You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kamiseq <ka...@gmail.com> on 2011/11/20 23:59:33 UTC
RestartResponseAtInterceptPageException from onClick
hej,
I'm just looking form clarification on
RestartResponseAtInterceptPageException and continueToOriginalDestination().
On every page I have a log-in link, and after log in I should be redirected
back to the original destination. I use oauth api that requires that I
redirect user to external url and then user will be redirected back to my
service.
In handler for onClick i have
new RestartResponseAtInterceptPageException(MainPage.class);
throw new RedirectToUrlException(url);
intercept page does not matter as I do not throw the exception I just save
InterceptData in session so next time I call
continueToOriginalDestination() this data will be used.
the only problem is that while saving (from
RestartResponseAtInterceptPageException.InterceptData)
Request request = RequestCycle.get().getRequest();
data.originalUrl = request.getOriginalUrl();
originalUrl point to onClick callback and then app loops.
I could of course save page instance and then redirect to it, but this is
reinventing the mechanism that wicket already provides, isn't it?
I know that RestartResponseAtInterceptPageException is used with accessing
protected resources with IUnauthorizedComponentInstantiationListener and
then url always points to page and not to handler.
thanks for any comment on that
pozdrawiam
Paweł Kamiński
kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________
Re: RestartResponseAtInterceptPageException from onClick
Posted by kamiseq <ka...@gmail.com>.
ok thanks for quick replay,
I think there should be more info in javadoc about the intension fo the
exception and continueToOriginalDestination method
pozdrawiam
Paweł Kamiński
kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________
On 21 November 2011 03:40, Bertrand Guay-Paquet <be...@step.polymtl.ca>wrote:
> Hi,
>
> If you need a reference to the referrer, you could simply store the
> current page's PageReference which is available with
> getPage().getPageReference(). Then use setResponsePage(SignInPage.**class)
> to go to the login page. PageReference is a serializable id that can later
> be used in your login form submit method with setResponsePage(pageRef.**
> getPage());
>
> There is no need for using the exception mechanism for this. Storing in
> the session means that multiple tabs won't work. You might want to send the
> pageRef directly as a parameter to the SignInPage constructor instead, but
> it will make your page stateful.
>
> Bertrand
>
>
> On 20/11/2011 5:59 PM, kamiseq wrote:
>
>> hej,
>> I'm just looking form clarification on
>> RestartResponseAtInterceptPage**Exception and
>> continueToOriginalDestination(**).
>>
>> On every page I have a log-in link, and after log in I should be
>> redirected
>> back to the original destination. I use oauth api that requires that I
>> redirect user to external url and then user will be redirected back to my
>> service.
>> In handler for onClick i have
>>
>> new RestartResponseAtInterceptPage**Exception(MainPage.class);
>> throw new RedirectToUrlException(url);
>>
>> intercept page does not matter as I do not throw the exception I just save
>> InterceptData in session so next time I call
>> continueToOriginalDestination(**) this data will be used.
>>
>> the only problem is that while saving (from
>> RestartResponseAtInterceptPage**Exception.InterceptData)
>>
>> Request request = RequestCycle.get().getRequest(**);
>> data.originalUrl = request.getOriginalUrl();
>>
>> originalUrl point to onClick callback and then app loops.
>>
>> I could of course save page instance and then redirect to it, but this is
>> reinventing the mechanism that wicket already provides, isn't it?
>> I know that RestartResponseAtInterceptPage**Exception is used with
>> accessing
>> protected resources with IUnauthorizedComponentInstanti**ationListener
>> and
>> then url always points to page and not to handler.
>>
>> thanks for any comment on that
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq@gmail.com
>> pkaminski.prv@gmail.com
>> ______________________
>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: RestartResponseAtInterceptPageException from onClick
Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Hi,
If you need a reference to the referrer, you could simply store the
current page's PageReference which is available with
getPage().getPageReference(). Then use setResponsePage(SignInPage.class)
to go to the login page. PageReference is a serializable id that can
later be used in your login form submit method with
setResponsePage(pageRef.getPage());
There is no need for using the exception mechanism for this. Storing in
the session means that multiple tabs won't work. You might want to send
the pageRef directly as a parameter to the SignInPage constructor
instead, but it will make your page stateful.
Bertrand
On 20/11/2011 5:59 PM, kamiseq wrote:
> hej,
> I'm just looking form clarification on
> RestartResponseAtInterceptPageException and continueToOriginalDestination().
>
> On every page I have a log-in link, and after log in I should be redirected
> back to the original destination. I use oauth api that requires that I
> redirect user to external url and then user will be redirected back to my
> service.
> In handler for onClick i have
>
> new RestartResponseAtInterceptPageException(MainPage.class);
> throw new RedirectToUrlException(url);
>
> intercept page does not matter as I do not throw the exception I just save
> InterceptData in session so next time I call
> continueToOriginalDestination() this data will be used.
>
> the only problem is that while saving (from
> RestartResponseAtInterceptPageException.InterceptData)
>
> Request request = RequestCycle.get().getRequest();
> data.originalUrl = request.getOriginalUrl();
>
> originalUrl point to onClick callback and then app loops.
>
> I could of course save page instance and then redirect to it, but this is
> reinventing the mechanism that wicket already provides, isn't it?
> I know that RestartResponseAtInterceptPageException is used with accessing
> protected resources with IUnauthorizedComponentInstantiationListener and
> then url always points to page and not to handler.
>
> thanks for any comment on that
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org