Thanks,

I was able to convert a DownloadLink to a ResourceLink (backed by a byte[]),
BUT that changed the behavior of the link.

Previously, all clicks on the DownloadLink would result in a Open / Save As
dialog box. This is what we want. The file type is MS Excel, and it was
offering to open or save the file.

Now, with the ResourceLink, it's a little different:

1) The Excel file opens immediately inside of IE, no prompts
2) If, from another browser/session, the link is clicked by another user,
there's an Excel error, "A document with the name 'localhost' is already
open"

The code:

ByteArrayResource bar = new ByteArrayResource("application/vnd.ms-excel",
generateExcelBytes()); //returns byte[]
ResourceLink exportLink = new ResourceLink("exportLink", bar);
add(exportLink);

Previously, with the DownloadLink, the code was:

DownloadLink exportLink = new DownloadLink("exportLink",
generateExcelFile()); //returns File
add(exportLink);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-avoid-keeping-files-on-the-server-with-DownloadLink-tp3750767p3750974.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to