Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Filetype in Firefox  RSS feed

 
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
 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!