You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francois Meillet <fr...@gmail.com> on 2021/07/20 12:35:02 UTC

RestartResponseException ajaxbutton

I have two pages (identical) called PageOne and PageTwo, each with a form, mounted with an UnVersionedUrlMapper.
			
When I do a RestartResponseException in the submit (via an AjaxButton) to the same page (from pageOne to pageOne),
the PageOne's constructor is called twice. (onInitialize is called once)
			
But If I throw RestartResponseException (via an AjaxButton) from pageOne to pageTwo the PageTwo's constructor is called once or if I throw RestartResponseException (via a standard Button) from pageOne to pageOne the pageOne's constructor is called once.
			
			
Tested with all the 9.x
			
			
Here is the test the UnVersionedUrlMapper # mapHandler
if (requestHandler instanceof ListenerRequestHandler || requestHandler instanceof BookmarkableListenerRequestHandler) {
    return null;
}
else {
    return super.mapHandler(requestHandler);
}

    			
Did I miss something or am I misusing RestartResponseException ?
Are the tests in the UnVersionedUrlMapper wrong ?

Thanks for your help.



Re: RestartResponseException ajaxbutton

Posted by Francois Meillet <fr...@gmail.com>.
yes page id = null

Thanks Sven,

François



> Le 21 juil. 2021 à 16:32, Sven Meier <sv...@meiers.net> a écrit :
> 
> page id


Re: RestartResponseException ajaxbutton

Posted by Sven Meier <sv...@meiers.net>.
Hi,

there a slight difference on how the response is rendered, see 
WebPageRenderer#shouldRedirectToTargetUrl()

     (isAjax(cycle) && targetUrl.equals(currentUrl))

This is the case for the Ajax submit creating PageOne, where - after the 
redirect - an additional page instance is created (since the URL does 
not contain a page id).
In both other cases the rendering result of the target page is buffered 
and fetch afterwards by the redirect.

>Did I miss something or am I misusing RestartResponseException ?
>Are the tests in the UnVersionedUrlMapper wrong ?

I don't know why you are using UnVersionedUrlMapper or where it is 
coming from, so I cannot comment on it.

Your usage of RestartResponseException seems correct.

Best regards
Sven


On 20.07.21 14:35, Francois Meillet wrote:

> I have two pages (identical) called PageOne and PageTwo, each with a form, mounted with an UnVersionedUrlMapper.
> 			
> When I do a RestartResponseException in the submit (via an AjaxButton) to the same page (from pageOne to pageOne),
> the PageOne's constructor is called twice. (onInitialize is called once)
> 			
> But If I throw RestartResponseException (via an AjaxButton) from pageOne to pageTwo the PageTwo's constructor is called once or if I throw RestartResponseException (via a standard Button) from pageOne to pageOne the pageOne's constructor is called once.
> 			
> 			
> Tested with all the 9.x
> 			
> 			
> Here is the test the UnVersionedUrlMapper # mapHandler
> if (requestHandler instanceof ListenerRequestHandler || requestHandler instanceof BookmarkableListenerRequestHandler) {
>      return null;
> }
> else {
>      return super.mapHandler(requestHandler);
> }
>
>      			
> Did I miss something or am I misusing RestartResponseException ?
> Are the tests in the UnVersionedUrlMapper wrong ?
>
> Thanks for your help.
>
>
>
>
>
>
> François
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org