You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tobias Gierke <to...@code-sourcery.de> on 2013/07/04 11:04:03 UTC

Scheduled IRequestHandler never executed ?

Hi,

I have a modal dialog window that - after closing - should start a file 
download.

Basically I'm doing everything like in 
http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3C1364779681800-4657667.post@n4.nabble.com%3E 
(AJAX response with setTimeout() call that redirects the browser to an 
AJAX behaviour which in turn invokes 
IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
file data).

-----------------------
     @Override
     protected void respond(AjaxRequestTarget target)
     {
         
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
fileDownloadRequestHandler );
     }
-----------------------

I've set a debugger breakpoint inside my respond() method and it's being 
correctly called after the modal dialog is closed - but for some reason 
the scheduled request handler never gets invoked by Wicket.

Cheers,
Tobias

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


Re: Scheduled IRequestHandler never executed ?

Posted by Tobias Gierke <to...@code-sourcery.de>.
Hi Sven,
> Hi,
>
> when your behavior is triggered, an AjaxRequestHandler is already 
> scheduled to generate the Ajax response for Wicket's JavaScript.
> It doesn't make sense to replace scheduled handler with a fileDownload 
> then. Whatever you'll send back to the browser, Wicket's JavaScript 
> won't understand it.

You misunderstood me, closing the modal window is ofc an AJAX request 
and the response to this request contains

         
ajaxTarget.appendJavaScript("setTimeout(\"window.location.href='" + url 
+ "'\", 100);");

where URL is the actual 'download' behaviour's callback URL.  After 100 
ms the browser initiates a regular HTTP GET request and this is where I 
schedule my file download request handler (just like described in the 
link I posted).

Cheers,
Tobias

>
> Sven
>
> On 07/04/2013 11:04 AM, Tobias Gierke wrote:
>> Hi,
>>
>> I have a modal dialog window that - after closing - should start a 
>> file download.
>>
>> Basically I'm doing everything like in 
>> http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3C1364779681800-4657667.post@n4.nabble.com%3E 
>> (AJAX response with setTimeout() call that redirects the browser to 
>> an AJAX behaviour which in turn invokes 
>> IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
>> file data).
>>
>> -----------------------
>>     @Override
>>     protected void respond(AjaxRequestTarget target)
>>     {
>> getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
>> fileDownloadRequestHandler );
>>     }
>> -----------------------
>>
>> I've set a debugger breakpoint inside my respond() method and it's 
>> being correctly called after the modal dialog is closed - but for 
>> some reason the scheduled request handler never gets invoked by Wicket.
>>
>> Cheers,
>> Tobias
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Scheduled IRequestHandler never executed ?

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

when your behavior is triggered, an AjaxRequestHandler is already 
scheduled to generate the Ajax response for Wicket's JavaScript.
It doesn't make sense to replace scheduled handler with a fileDownload 
then. Whatever you'll send back to the browser, Wicket's JavaScript 
won't understand it.

Sven

On 07/04/2013 11:04 AM, Tobias Gierke wrote:
> Hi,
>
> I have a modal dialog window that - after closing - should start a 
> file download.
>
> Basically I'm doing everything like in 
> http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3C1364779681800-4657667.post@n4.nabble.com%3E 
> (AJAX response with setTimeout() call that redirects the browser to an 
> AJAX behaviour which in turn invokes 
> IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
> file data).
>
> -----------------------
>     @Override
>     protected void respond(AjaxRequestTarget target)
>     {
> getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
> fileDownloadRequestHandler );
>     }
> -----------------------
>
> I've set a debugger breakpoint inside my respond() method and it's 
> being correctly called after the modal dialog is closed - but for some 
> reason the scheduled request handler never gets invoked by Wicket.
>
> Cheers,
> Tobias
>
> ---------------------------------------------------------------------
> 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


[SOLVED] Re: Scheduled IRequestHandler never executed ?

Posted by Tobias Gierke <to...@code-sourcery.de>.
Sorry for the noise, I just found out that 
scheduleRequestHandlerAfterCurrent() silently accepts NULL handlers and 
I was passing a NULL value...

> Sorry, forgot to mention that I'm using Wicket 1.5.8
>
>> Hi,
>>
>> I have a modal dialog window that - after closing - should start a 
>> file download.
>>
>> Basically I'm doing everything like in 
>> http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3C1364779681800-4657667.post@n4.nabble.com%3E 
>> (AJAX response with setTimeout() call that redirects the browser to 
>> an AJAX behaviour which in turn invokes 
>> IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
>> file data).
>>
>> -----------------------
>>     @Override
>>     protected void respond(AjaxRequestTarget target)
>>     {
>>         
>> getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
>> fileDownloadRequestHandler );
>>     }
>> -----------------------
>>
>> I've set a debugger breakpoint inside my respond() method and it's 
>> being correctly called after the modal dialog is closed - but for 
>> some reason the scheduled request handler never gets invoked by Wicket.
>>
>> Cheers,
>> Tobias
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Scheduled IRequestHandler never executed ?

Posted by Tobias Gierke <to...@code-sourcery.de>.
Sorry, forgot to mention that I'm using Wicket 1.5.8

> Hi,
>
> I have a modal dialog window that - after closing - should start a 
> file download.
>
> Basically I'm doing everything like in 
> http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3C1364779681800-4657667.post@n4.nabble.com%3E 
> (AJAX response with setTimeout() call that redirects the browser to an 
> AJAX behaviour which in turn invokes 
> IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
> file data).
>
> -----------------------
>     @Override
>     protected void respond(AjaxRequestTarget target)
>     {
>         
> getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
> fileDownloadRequestHandler );
>     }
> -----------------------
>
> I've set a debugger breakpoint inside my respond() method and it's 
> being correctly called after the modal dialog is closed - but for some 
> reason the scheduled request handler never gets invoked by Wicket.
>
> Cheers,
> Tobias
>
> ---------------------------------------------------------------------
> 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