if (log4j.isDebugEnabled())
log4j.debug("Beginning of response.setContentType");
response.setContentType("application/pdf; charset=UTF-8");
if (log4j.isDebugEnabled())
log4j.debug("Beginning of driver");
Driver driver = new Driver();
driver.setLogger(globalParameters.getFopLogger());
driver.setRenderer(Driver.RENDER_PDF);
driver.setInputSource(inputFO);
// ByteArrayOutputStream out = new ByteArrayOutputStream();
driver.setOutputStream(response.getOutputStream());
if (log4j.isDebugEnabled())
log4j.debug("driver.run()");
driver.run();
/*
* log4j.info("Beginning of out.toByteArray()"); byte[] content = out.toByteArray();
* log4j.info("Beginning of response.setContentLength");
* response.setContentLength(content.length);log4j.info(
* "Beginning of response.getOutputStream().write(content)");
*/
/*
* int incr = 1000; for (int i=0;i<content.length;i+=incr) { int end =
* ((content.length<(i+incr))?content.length-i:incr);
* response.getOutputStream().write(content, i, end); response.getOutputStream().flush(); }
*/
/*
* response.getOutputStream().write(content);
* log4j.info("Beginning of response.getOutputStream().flush()" );
* response.getOutputStream().flush();
*/
if (log4j.isDebugEnabled())
log4j.debug("End of renderFO");
response.getOutputStream().flush();
response.getOutputStream().close();
sr.close();
driver.reset();
driver = null;
} else {
response.setContentType("application/pdf; charset=UTF-8");
RenderFoI render = (RenderFoI) Naming.lookup("rmi://"
+ globalParameters.strServidorRenderFo + "/RenderFo");