File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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

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.

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
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:
subject: Urgent-servlet response
It's not a secret anymore!