File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Urgent-servlet response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Urgent-servlet response" Watch "Urgent-servlet response" New topic
Author

Urgent-servlet response

Dhanashree Mankar
Ranch Hand

Joined: Aug 25, 2003
Posts: 123
How to send a response as binary file or image?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

obtain a binary stream from the response rather than a writer, set the response mime type, pipe the data.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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.


42
Dhanashree Mankar
Ranch Hand

Joined: Aug 25, 2003
Posts: 123
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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Urgent-servlet response