• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in opening a RTF File  RSS feed

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey All,

I am trying to open a RTF file and provide the option to open or save for the user. The problem i am having is, somehow the file shows up with the extension .do and does not recognize the file type. Any thoughts why this is happening. I am guessing that the FILE TYPE is not getting recognized correctly .

response.setContentType("application/rtf");
response.setHeader("Content-disposition","attachment;file="+ filename);


Any suggestion will be appreciated
 
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've had this problem too. From what I can tell, most browser plugins will use the last bit of the request URL as the default "save as" file name. A possible way to work around this is to provide the file name you want used for the "save as" action as the last bit of the query string: e.g. MyAction.do?filename=mydoc.rtf

I don't remember if this works. If not, you'll have to change the request URL to just mydoc.rtf and then configure your web app to forward all requests ending in .rtf to a particular servlet (i.e. MyAction.do).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!