I'm using an AjaxLink and in it's onClick() method i'm doing the following stuff:
- start download (getRequestCycle().scheduleRequestHandlerAfterCurrent( new RedirectRequestHandler("http://" + url "));)
- display feedback message (download started...)
- update ListView (add text to it)
- 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.
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