Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Womblek
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic