Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file download from JSP ?

 
tricktan
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a JSP that pulls a file (i.e. Ms Word doc file) from a database and pushes it to the client for download.
I tried to use:
response.setContentType("Application/Octet-Stream");
..loop..
out.print(achararray);
and I can only see my web browser show binary charactes .
How do I make the browser recognize the binary chars. as a file ?
Thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you want to set the content type specific
for the application.
"application/msword"
and make sure your browser has a setting for
this MIME type.
To find listings of MIME types try searching
at Yahoo. Here is one listing I found recently:
http://www.ltsw.se/knbase/internet/mime.htp
 
tricktan
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the solution,
you need to setHeader();
setContentType(application/octet-stream) <--generic application
some pointers too.. don't put any HTML or text tags, this will screw up the application file binary output stream
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic