xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: fop in a servlet in 0.91beta very different from 0.20.5
Date Fri, 10 Feb 2006 12:42:53 GMT
I can't reproduce the problem. Here's what I've done:
- Created a new servlet cass extending from HttpServlet.
- Copy/pasted the sample code from http://xmlgraphics.apache.org/fop/0.91/servlets.html#xslt
into the servlet class (in an empty doGet() method)
- Added a try/catch around everything to get rid of the exception errors.
- Removed the Source for the stylesheet so I get an identity
- I then ran the servlet in Jetty and the PDF was generated just fine.

- Then, I did the same with the code you posted. I only replaced your
offer stuff with a simple StreamSource to an existing FO file.
- I then ran the servlet in Jetty and the PDF was generated just fine.

Concerning Constants.RENDER_PDF: I forgot to update that part when I
updated the docs for the last release. This is fixed on the web. But you
obviously found the right thing to change.

So, I think your code is ok (except for the offer stuff which I find
very suboptimal from a performance POV). It must be something else.
Since you catch any exception with an e.printStackTrace() (probably not
the best idea) I assume you got an exception in your code and didn't
check the log output of your web container. The web container probably
sends back an empty document to the browser in this case.

BTW, it's a good idea to extract the FOP-specific code into a separate
class which you can test and debug outside the web container.

On 10.02.2006 12:30:12 Roberto Nunnari wrote:
> Hello list.
> I'm trying to move from 0.20.5 to 0.91beta.
> Here's a problem I'm facing: following the instruction
> in the documentation that comes the 0.91beta, lead to
> code that doesn't compile.
> So I modified it as follows to be able to compile, but
> the result I get executing it wrong.. I get an empty
> text/html document instead of the expected application/pdf
> below's the code in the get/post servlet method and probably
> the main difference from the documentation is the parameter
> in the Fop constructor MimeConstants.MIME_PDF vs Constants.RENDER_PDF).
> Note that this code is the same I used with FOP 0.20.5 with
> just a few modification:
> 1) no Driver, but Fop
> 2) no driver.run() but transformer.transform()

Jeremias Maerki

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

View raw message