After the last week's thread about running FOP in a servlet,
I thought I'd review the examples  with a view to improving
the end-user experience and flattening the learning.

Some notes:

The current sample: org.apache.fop.servlet.FopServlet has been
improved in HEAD but the packaging seems (IMHO) to have suffered.

In 0.20.5 the examples/servlet directory contains a fully-functional
web application that can be deployed and run in the latest Tomcat.
This webapp includes a valid build.xml file so one can simply type:
'ant' in the examples/servlet directory. Even better, the Ant Farm
plugin in Jedit can build 'fop.war'. From the Tomcat Manager window,
you can upload 'fop.war' and use the webapp right away.

The HEAD version of FopServlet has been rewritten to use JAXP
and works reasonably well. Unfortunately, the examples/servlet
directory has disappeared from the project. It has not disappeared 
from the documentation, so there is an error there.

The servlet seems to make provisions for peculiarities of the Acrobat
plug-in (writes the PDF to a memory buffer then copies this to 
response.getOutputStream() after setting the Content-length header).
This knowledge SHOULD appear in program comments. The same is true 
for information about Internet Explorer and it's need for the filetype
'.pdf' in the base URL and the end of the invoking URL. One could even
update the example to issue a redirect for Evil(tm) User Agents so that
the IE user's request is corrected for him (heh .. heh).

Would anyone be offended if we were to put the examples/servlet back in
to the build ? We could update the deployment descriptor to use:
org.apache.fop.servlet.FopServlet (and FopPrintServlet) as well as one
or two new examples (whose code appears in the examples/servlet
directory), that illustrate other concepts such as cached Templates
objects and the use of Deflator/Inflator streams to reduce the size of
the in-memory PDF file buffer. I have some thoughts about generalizing
FopServlet to use URL parameters so that both server-side files and
network-resident HTTP resources would be usable.

I would consider adding some of my own test files which demonstrate the
use of FOP to generate letters and print envelopes from data base

It should be possible to build a servlet example that executes all of
the .fo and .xml/.xsl files in the examples directory. It would be
nice for potential users to have an out-of-box webapp that runs a 
large number of our examples. 

Reply via email to