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]