Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filetype in Firefox

 
Hakan Axheim
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a servlet that streams an ICalendar. As you can see I have used the setContentType and setHeader method in response objekt. When I use the IE 7.0 I receive an calender.ics file that should be downloaded to the filesystem but in Firefox the extension to the filename will be deleted. So the filename will be just calendar in Firefox but in IE it will be calendar.ics.

response.setContentType("text/calendar; charset=UTF-8");
response.setHeader("ContentDisposition","attachment;filename=calendar.ics");

OutputStream writer = response.getOutputStream();
ICALCalendar cal = (ICALCalendar) model.get("ical");
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(cal.getCalendar(), writer);

writer.close();

Can anyone tell me whats wrong?

/H�kan
 
Leinad Jan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you to use response.setHeader("ContentDisposition","attachment;filename=\"calendar.ics\"");

Like that, FireFox know that calendar.ics is a String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic