aspose file tools*
The moose likes Java in General and the fly likes Display byte[] in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Display byte[] in browser" Watch "Display byte[] in browser" New topic
Author

Display byte[] in browser

Subha Rangu
Greenhorn

Joined: Jul 23, 2004
Posts: 29
I have a Java program which retrieves a TIFF Document/Image in byte[] format. Can anybody tell what has to be used inorder to see my image on the browser from a jsp/Java code.
Thanks
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
I'm guessing now, but have you tried setting the contentType to "image/tiff" and just writing the byte[] to the response?

Jules
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
response.setContentType("image/tiff");
OutputStream out = response.getOutputStream();
// write the byte[] to 'out'


Tony Morris
Java Q&A (FAQ, Trivia)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
You may also have to set the Content-length to make the browser happy.
Bill
Subha Rangu
Greenhorn

Joined: Jul 23, 2004
Posts: 29
Hi Tony and Julian,
Thank you very much for all the help. I got stuck up with this problem the whole day yesterday. I could solve it now. I will be really thankful to you guys...
 
 
subject: Display byte[] in browser