wood burning stoves
The moose likes JSP and the fly likes set Content-Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "set Content-Type" Watch "set Content-Type" New topic

set Content-Type

Peter Heng

Joined: Aug 12, 2003
Posts: 13
If I want to flush my output to CSV file, I use:

response.setHeader("Content-Type", "application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=download.csv");

But what to set for the Content-Type if I want my output in TXT file? Please help
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63542

"Istrong Punk",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
It is sorta covered in the JavaRanch Style Guide.
subject: set Content-Type
It's not a secret anymore!