I guess I forgot to mentionthe single most important aspect of my question:
The archive not present on the file system, it is dynamically
assembled on the fly from individual files.
(the whole point is downloading multiple files in one go.)


Gabor Szokoli

On Dec 11, 2007 11:45 PM, Jeremy Levy <[EMAIL PROTECTED]> wrote:
> Gabor,
>
> Try DownloadLink
> http://wicket.sourceforge.net/apidocs/wicket/markup/html/link/DownloadLink.html
>
> J
>
>
> On Dec 11, 2007 5:39 PM, Gabor Szokoli <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
> >
> > The downside of an easy-to-use framework is the influx of users with
> > little understanding of the underlying servlet technology, like me.
> > Observe:
> >
> > I'd like to provide a ZIP file (could be TAR, anything Windows PCs can
> > save and later extract from) as a download, one that is potentially
> > too big to be kept in memory in full.
> > So I guess I'd need to "stream" it in chunks, or as a java stream or
> > channel.
> > Can I do that from wicket?
> > Or does the servlet interface require a fully assembled response in
> > memory?
> >
> > Currently I assemble the ZIP file in a byte array in full, but it
> > feels awkward. Would extending WebResource fit the bill?
> >
> >                        ByteArrayOutputStream bout = new
> > ByteArrayOutputStream();
> >                        ZipOutputStream zout = new ZipOutputStream(bout);
> >                        // Add entries
> >                        zout.finish();
> >                        zout.close();
> >
> >                        Resource resource = new
> > ByteArrayResource("application/zip",
> > bout.toByteArray());
> >                        ResourceStreamRequestTarget target = new
> > ResourceStreamRequestTarget(resource.getResourceStream());
> >                        target.setFileName(new
> > SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance
> > ().getTime())
> > + ".zip");
> >                        getRequestCycle().setRequestTarget(target);
> >
> >
> > All suggestions are welcome.
> >
> >
> > Gabor Szokoli
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to