Hi, in my project I use a CouchDB with files as attachments. Currently I have a page that makes those attachments available via a ResourceLink. What I do when creating that page is:
- I read all attachments (I get them as an InputStream), - create a byte[] out of it, - create a static Wicket ByteArrayResource - and put the link to that resource on the page. That works for smaller files, but a huge problem is of course: it's static, and I get memory problems if the attachments get too big. Also, currently obviously each session does this. What I would like to do instead is: - create Resources that will load my attachments dynamically if the link is clicked, - and add ResourceLinks to those resources on my page instead. - If possible, maybe deliver the attachments directly from the InputStream my CouchDB delivers, so I don't have to have any static byte-arrays on my server. That way I could make the page load immediately and deliver attachments only if required. I've wrapped my head around IResourceStreams, but I just can't see clear anymore and am confused about how to create those dynamic resources (also because some old examples don't work anymore with Wicket 1.5 or 6beta3). I'd be very thankful for a short example, or a hint about how to design this. Thank you!