Hi guys, I am _really_ sorry for breaking a thread and re-posting it in a separate, but for some reason my personal mailbox was not hit with the answer, I only was able to find it in archives. Subscribed now.
Unfortunately, the solution proposed would not work for me. The one in http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ would work well for files, etc, but the issue is that I have a resource, which is generated on-the-fly using values of the component's model. Just to give you a quick sample: // in page ctor: ... AJAXDownload<Data> download = new AjaxDownload<Data>() { @SpringBean private PDFGenerator pdfGenerator; public void getFileName() { return getComponent().getModelObject().getCyrillicFileName(); } public void getResourceStream() { return new ByteArrayResource(getComponent().getModelObject().getMimeType(), pdfGenerator.generateSmall(getComponent().getModelObject())).getResourceStream(); } } // end AjaxDownload AjaxLink<Data> dloadLink = new AjaxLink<Data>("download") { public void onClick(AjaxRequestTarget target) {downloadBehavior.initiate(target);} ) add(dloadLink); ... The issue with this code is that it is coupled with the model. I was also thinking of another solution: 1. Create a specific page with HybridMountParam or whatever allowing for any number of slashes in the end (so that the filename'd be considered just an ignored param. 2. Whenever the download behavior is needed, attach the download behavior to this component/page, persisting models in it. The issue with this approach is that URL mounting seems to be performed on the page basis, and I see no way of obtaining the reference to a new Page... Maybe there's a way we may attach many IBehaviorListeners to the instance of a page which would then mount under any URL we need? Thank you - and kindest regards, Alex. >On Thu, Dec 15, 2011 Martin Grigorov wrote: ><lex...@gmail.com> wrote: >Hi, > >In my app we use Wicket's Resource to upload/download files. We do it >to avoid synchronization on page access but I think you can solve your >problem with this. > >Unfortunately I imagine the full solution with Wicket 1.5's >#mountResource(). See >http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ for >more details. > >On Thu, Dec 15, 2011 at 11:54 PM, Alexander Cherednichenko ><lex...@gmail.com> wrote: >> Hello! >> >> Faced an interesting problem, however few hours of googling and trial did >> not lead to success. wicket is 1.4 >> >> The problem: I have an AjaxDownload ( >> https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html) >> or DownloadLink ( >> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/link/DownloadLink.html), >> both very good and cool components. Thank you the developers! I am >> streaming a dynamically-generated content to the user and want them to save >> it as a file. Usual implementation of both is coming down >> to ResourceStreamRequestTarget, which in turn does the actual streaming and >> also sets the content-disposition: attachment; filename=''. This does not >> work for non-ascii. -- Alexander Cherednichenko [ the only way out is the way up ]