my dog learned polymorphism*
The moose likes Servlets and the fly likes ServletOutputStream.write not working in IE 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletOutputStream.write not working in IE 7" Watch "ServletOutputStream.write not working in IE 7" New topic

ServletOutputStream.write not working in IE 7

JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
Has anyone encountered this problem before? I'm trying to render a PDF document through the browser. It's working fine in Firefox, but i get an "IE cannot display the page" error page. Here's my code:

String xml = "<PdfBean/>";
StreamSource xmlSource = new StreamSource(new ByteArrayInputStream(xml.getBytes()));

InputStream is = new
StreamSource xslSource = new StreamSource(is);
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer(xslSource);

FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

ByteArrayOutputStream out = new ByteArrayOutputStream();

Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,out);

// perform transformation
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(xmlSource, res);

//Prepare response

//Send content to Browser
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

Any errors in the logs?
JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
No errors in the logs. It just doesn't render in IE
Thanuja Vishwanath
Ranch Hand

Joined: Oct 07, 2010
Posts: 49
Even i face the same issue. Iam not getting error. It just that nothing is opened. This happens in both IE and chrome. I did not test in firefox. Please let me know if your issue is resolved. If so what was the cause? If you could reply it would really help me in solving my issue.

jQuery in Action, 2nd edition
subject: ServletOutputStream.write not working in IE 7
Similar Threads
XSL-FO Multiple Page Sequences
Java : avalon framework configuration exception
Strange FOP behaviour
Using FOP
how to embed Asian font while genrating PDF using FOP