Has anyone run into issues with Safari tacking on ".html" to filenames when attempting to do attachment downloads? (CSV data, in this case.)
I can't for the life of me figure out how to get Safari to just use .csv as the file extension. Firefox, of course, works just fine...
public void appendToResponse(WOResponse response, WOContext context) {
log.debug("appendToResponse()");
super.appendToResponse(response, context);
try {
fetchActivities();
String report = generateReport();
log.debug(" report = " + report);
response.setContent(report);
response.setStatus(WOMessage.HTTP_STATUS_OK);
response.setContentEncoding("UTF8");
response.setHeader("attachment; filename="+reportFilename,"Content-Disposition");
response.setHeader("text/csv", "Content-Type");
} catch (Exception e) {
System.out.println("Error Downloading file: " + e);
}
}
- Leif