Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble serving Word doc  RSS feed

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have my little Wiki server delivering wiki pages and images just fine. Now I'm trying to return other document types. My first try with MS Word sends data back to the browser, but it is displayed as oddball characters, apparently trying to interpret binary data as HTML.
Here are the headers I'm sending in front of the bytes:

The code to send the data reads a byte array from disk and writes it to socket OutputStream. It works fine for images.

The BytesInFile variable matches what I see on disk so I think I got everything and nothing extra. Any ideas?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this sounds really obvious, but are you sure your browser is configured to recognize that specific MIME type as Word document? There have been others, like application/x-vnd-msword. Check your browser configuration to be sure.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip. I have no idea what I changed but it started woroking. It launches Word to view the doc instead of trying to render it in the browser, but I think I don't care right now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!