• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with save-as dialog ;rtf file download  RSS feed

 
madhu gun
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i have got a problem with downloading rtf
file.
I was reading an rtf file from local system(servlet system) and it was downloading fine in browser with correct name with save as dialog ofcourse my browser has rtf plugin.
But I have changed the code now as getting the file as a string from my ejb and writing the string to the out with setContentType and setContentHeader as it is.but now it directly opens in browser.
But if the file is procured by reading from file system by servlet,then the save as dialog does not have problem.
I tried using servletoutputstream.write(bytearray) also after conevrting the string into bytearray using getBytes.it doesn't work .Any ideas please.
code::
resp.setContentType("application/rtf");//text/richtext also tried
resp.setHeader("Content-Disposition","attachment;filename="+file);
soStream=resp.getOutputStream();
byte[]byteArray=file.getBytes();
soStream.write(byteArray);//snippet abc
soStream.close();//snippet abc

regards
madhu
[ April 18, 2002: Message edited by: madhu gun ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would certainly setContentLength too, that frequently helps.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!