Thank you very much Sven !

Yes I prefer to work with IResourceStream because the my export feature
(took from Wicket) already works this way, it just need to be ajaxified ;)
That looks nice! I somehow missed the ResourceStreamResource... I will give
a try in the coming days.

Best regards,
Sebastien.


On Sat, Apr 1, 2017 at 11:10 PM, Sven Meier <[email protected]> wrote:

> Hi Sebastien,
>
> AjaxDownload uses IResource and ResourceReference as ResourceLink does it
> - IMO these are the most general abstractions for resources in Wicket.
>
> If you prefer to work with an IResourceStream, you can pass a
> ResourceStreamResource to AjaxDownload's constructor:
>
> new AjaxDownload(new ResourceStreamResource() {
>     {
>         setFileName("myfilename");
>         setContentDisposition(ContentDisposition.ATTACHMENT);
>     }
>     protected IResourceStream getResourceStream(Attributes attributes) {
>         return new DataExporterResourceStreamWriter(new
> CSVDataExporter(), provider, columns);
>     }
> });
>
> With this lazy creation of the stream, it is not necessary to hold it in
> the component tree.
>
> Have fun
> Sven
>

Reply via email to