fstream = new FileWriter(fileLocation);
BufferedWriter out = new BufferedWriter(fstream);
out.write("TEST");
out.flush();
out.close();
and I create it in the /tmp directory, how do I make this downloadable from within a Vaadin Portlet? I have found that if I get the Window and look at the methods on it, there is a “open” but it requires a “resource” and not a filepath.
How do I convert my filepath (which points to the newly created CSV file) to a “resource” and then have it downloaded by the User?
This is a question I would like to have answered too…
However… meanwhile… have you looked at FileDownloader (com.vaadin.server.FileDownloader)
Example:
FileResource fr = new FileResource(new File(“C:/test”));
FileDownloader fd = new FileDownloader(fr);
fd.extend(buttonToClickForDownload); // connect the download action to a button click…
Is it possible to check if if the client downloaded the file or if the download is finished.
Because I generate a file which displays the current view or the content of a table (table data is changing while the server is running) on the server.
I’d like to delete it on the server as son as the download is finished.