public
class ResultsFileProvider extends FileResourceProvider {...
public File createFile() throws IOException {
// Default file name
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar cal = new GregorianCalendar();
String datetime = formatter.format(cal.getTime());
File file = File.createTempFile(datetime, ".csv");
file.deleteOnExit();
out.write(...);
out.close();
return file;
}
...
}
The parent class FileResourceProvider came directly from the application template.
The method to initiates the download is ...
/** * Export to Excel */ public void exportToExcel(int mode) {ResultsFileProvider provider =
new ResultsFileProvider(mts);String id = DownloadManager.
INSTANCE.put(provider); try{
DownloadManager.
INSTANCE.showDocument(id, "template");}
catch(IOException ioe){
System.
err.println("Cannot show document: " + ioe);}
}
I deployed my application on a Tomcat web server and run it via JNLP. The problem I encounter when I try to export to Excel, is that my IE browser shows the following URL
file:///D:/Apps/Tomcat%205.5/temp/2006-08-29.csv
which causes it to croak because the above file path is the path on my application server, not my local desktop.
Thanks,
Alex
