This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent-servlet response

 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to send a response as binary file or image?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
obtain a binary stream from the response rather than a writer, set the response mime type, pipe the data.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and never attempt to mix different content types in a single outputstream or you're bound to get a huge mess.
The number of times we've had to explain that to people is too large to count.
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an url repesenting image in database. I want to fetch the url and then pass that as an image to client
response.setContentType("image/gif")
OutputStream out= response.getOutputStream()
But how to send that to client?
do i need to use GifEncoder? if yes then how?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic