File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes when streaming doc ciontent to browser, multiple IE File Download prompts displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "when streaming doc ciontent to browser, multiple IE File Download prompts displayed" Watch "when streaming doc ciontent to browser, multiple IE File Download prompts displayed" New topic
Author

when streaming doc ciontent to browser, multiple IE File Download prompts displayed

Womblek
Greenhorn

Joined: Sep 16, 2003
Posts: 1
I am attempting to display document content to a browser via my JSP-based web app. Using the code below, the content is displayed but only after the user clicks OK on the Internet Explorer File Download prompt 3 times. Can someone please help? Thanks!
response.setHeader("Content-Disposition", "attachment; filename=\"" + docName + "\"");
response.setContentType(mimeType);
BufferedInputStream bis = new BufferedInputStream(obj.getContent());

ServletOutputStream so;
int index;
so = response.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(so);
int bufSize = bis.available();
byte[] buf = new byte[bufSize];
while ((index = bis.read(buf, 0, bufSize)) >= 0) {
bos.write(buf, 0, index);
}

bis.close();
bos.close();
so.close();
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Womblek,
Welcome to JavaRanch!
We don't have many rules here at JavaRanch, but we do have one. Please change your display name to comply with The JavaRanch Naming Policy. Mainly, you need a last name!
Thanks pardner, to see you 'round the Ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when streaming doc ciontent to browser, multiple IE File Download prompts displayed