Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Rendering ByteArrayOutputStream in IE through struts.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing a peculiar problem while rendering binary files in IE through servlets. Actually I read binary files stored as BLOB from the database (DB2) and render them on the internet explorer using a servlet (struts action class). This is the code i use to render the files;

byteArrayOutputStream = //get byteArrayOutputStream from the database.
ServletOutputStream sos = null;
StringBuffer sbContentDispValue = new StringBuffer();

sbContentDispValue.append("attachment");
sbContentDispValue.append("; filename=");

sbContentDispValue.append(sFileName);
response.setHeader(" Content-disposition",sbContentDispValue.toString());
response.setContentLength(byteArrayOutputStream.size());
response.setContentType("application/octet-stream");
response.setHeader("Cache-Control", "max-age=30");
sos = response.getOutputStream();
byteArrayOutputStream.writeTo(sos);
sos.flush();

When I run my application on windows (using WSAD 6.0), I get a open/save/cancel dialog box. But the moment I run the application from a unix system which has Websphere 6.0, I only get a save/cancel dialog box. Besides, the filename displayed in the dialog box is improper. I tried using the content type as "application/unknown", "application/x-download". But nothing seems to be working. Has anyone of you faced a similiar problem before? Any help would be most welcome.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic