Wicket - container not repainted / feedback message not shown in combination with a download (AjaxLink)

346 views Asked by At

I'm using an AjaxLink and in it's onClick() method i'm doing the following stuff:

  1. start download (getRequestCycle().scheduleRequestHandlerAfterCurrent( new RedirectRequestHandler("http://" + url "));)
  2. display feedback message (download started...)
  3. update ListView (add text to it)
  4. add the container (div) which contains the feedbackpanel and the ListView to the target: (target.add(...);)

So, the only thing what happens at first is the download dialog is shown and i can save it to my disk. But no feedback message is shown and the content stays the same (should be updated).

But if i press F5, the page gets reloaded and the feedback messages are shown and the content is updated. But i want to show it directly.

On the other side: if i remove the download call (getRequestCycle().scheduleRequestHandlerAfterCurrent( new RedirectRequestHandler("http://" + url "));) from the onClick mehtod, it works. So, the download is not triggered BUT the feedback messages are shown and the content is updated.

So, how can i handle that? The redirect / download causes the problem it seems.

I'm using wicket 6.

Edit: The url is calculated with RandomStringUtils for example... getRequestCycle().scheduleRequestHandlerAfterCurrent(new RedirectRequestHandler("http://" + url + "/test/" + randomString + "/download")); So i need java / wicket to do the stuff.

1

There are 1 answers

1
svenmeier On BEST ANSWER

You cannot serve the file contents and simultaneously send an Ajax response:

https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow