wood burning stoves 2.0*
The moose likes Servlets and the fly likes Filetype in Firefox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Filetype in Firefox" Watch "Filetype in Firefox" New topic

Filetype in Firefox

Hakan Axheim

Joined: Nov 24, 2008
Posts: 9

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");

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


Can anyone tell me whats wrong?

Leinad Jan

Joined: Feb 18, 2009
Posts: 28
I suggest you to use response.setHeader("ContentDisposition","attachment;filename=\"calendar.ics\"");

Like that, FireFox know that calendar.ics is a String.
I agree. Here's the link: http://aspose.com/file-tools
subject: Filetype in Firefox
Similar Threads
Setting headers correctly in Javamail
Trying to implement a mail queue in JavaMail using ExecutorService
Trying to create a threaded pool in JavaMail to deal with bulk mailing
Writing a FileOutputStream into a File
Performing two actions in one event Liferay