Hi Leif,
The code I use successfully differs from yours in a couple of ways. I
have included my relevant headers below and commented out yours.
David
On 6-Apr-09, at 1:11 PM, Leif Harrison wrote:
Hey guys,
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...
Here's my current appendToResponse (it's pretty simple, at the
moment):
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");
// Set the headers for browser want to save instead of
displaying
response.setHeader("application/octet-stream", "content-
type");
// Give the data a default name to save as
String contentDisposition = "attachment;filename=
\""+reportFilename+"\"";
response.setHeader(contentDisposition, "content-
disposition");
// response.setHeader("attachment;
filename="+reportFilename,"Content-Disposition");
// response.setHeader("text/csv", "Content-Type");
} catch (Exception e) {
System.out.println("Error Downloading file: " + e);
}
}
- Leif
----------
Leif Harrison
[email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx
%40mac.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]