It happened to me using IE to Tomcat on the local machine using 
'localhost'.  I switched to using the real network interface and it 
fixed itself.


Alex Amies wrote:

>I have a problem with a servlet, which serves up pdf documents, 
>invoking the servlet twice for every time I request the
>url using my browser.  The pdf document is produced 
>correctly in both instances.  Anybody else seen this
>problem, know what it is, or have a constructive suggestion?
>The servlet gets data from a database, formats into xml, 
>transforms it with Xalan, then again to a pdf, sending 
>the content to a byte array where it is then written to 
>the output stream.  Here is a code fragment:
>Writer writer = new StringWriter();
>// Get an xslt processor factory
>TransformerFactory tFactory = TransformerFactory.newInstance();
>// Create the 3 objects the XSLTProcessor needs to perform the
>ReportInfo reportInfo = getReportData(request,res);
>String xml = reportInfo.getXml();
>StringReader stringReader = new StringReader(xml);
>Source xmlSource  = new StreamSource(stringReader);
>Source xslSheet   = getXSLInput(reportInfo.getReportNo());
>StreamResult xmlResult = new StreamResult(writer);
>Transformer transformer = tFactory.newTransformer(xslSheet);
>// Perform the transformation.
>transformer.transform(xmlSource, xmlResult);
>// send output from xsl transformation to a string reader
>// create a input source containing the xsl:fo file which can be fed to
>Reader reader = new StringReader(writer.toString());
>//set Driver methods to start Fop processing
>Driver driver = new Driver();
>// send pdf writer output to a byte array stream
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>PrintWriter printWriter = new PrintWriter(baos);
>driver.buildFOTree(parser, new InputSource(reader));
>// send the bytes out to the servlet output stream
>long sixty = System.currentTimeMillis() + 60*1000;
>res.setDateHeader("Expires", sixty);
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, email: [EMAIL PROTECTED]

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to