You should consider that 2 users can be doing it at the same time.
Which will lead to serious errors.
I would suggest using a random file name (or one with session hash in the
filename) so you avoid userA downloading userB's download.zip

I would think that you should be able to just stream it right back to the
client as a redirect or smth. This temporary file thing seems very improper.

- Alex 

-----Original Message-----
From: Alex Zeit [mailto:[email protected]] 
Sent: Sunday, May 30, 2010 7:30 AM
To: [email protected]
Subject: Re: Creating and zipping binary files for download

Thank you very much Jeremy for your help. As you suggested I create
temporary dir and place files there.
Wicket is really great! The solution to my problem was just in couple of
lines of code:

    org.apache.wicket.util.file.File wdir = new
org.apache.wicket.util.file.File(createTempDirectory());
    ZipResourceStream zrs = new ZipResourceStream(wdir);
    ResourceStreamRequestTarget target = new
ResourceStreamRequestTarget(zrs, "download.zip");
    RequestCycle.get().setRequestTarget(target);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to