bdelacretaz 2003/05/02 07:05:47
Modified: src/blocks/fop/samples sitemap.xmap
src/blocks/fop/samples/cache-test xsp-sample-to-fo.xsl
src/blocks/fop/samples/misc samples.xml
Log:
FOP caching sample uses XSP page directly, works now
Revision Changes Path
1.4 +5 -4 cocoon-2.1/src/blocks/fop/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/fop/samples/sitemap.xmap,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sitemap.xmap 1 May 2003 14:41:57 -0000 1.3
+++ sitemap.xmap 2 May 2003 14:05:46 -0000 1.4
@@ -37,10 +37,11 @@
</map:match>
<!-- reuse the XSP caching example for our caching test -->
- <map:match pattern="cache-test-*-*-*.pdf">
- <map:generate
src="cocoon://samples/xsp/java/cacheable?pageKey={1}&other={2}&validity=30"/>
+ <map:match pattern="cache-test-*.pdf">
+ <!-- note that caching didn't work when accessing the XSP
using the cocoon:/ protocol -->
+ <map:generate src="../xsp/xsp/cacheable.xsp"
type="serverpages"/>
<map:transform src="cache-test/xsp-sample-to-fo.xsl">
- <map:parameter name="pages" value="{3}"/>
+ <map:parameter name="pages" value="{1}"/>
</map:transform>
<map:serialize type="fo2pdf"/>
</map:match>
1.2 +17 -20
cocoon-2.1/src/blocks/fop/samples/cache-test/xsp-sample-to-fo.xsl
Index: xsp-sample-to-fo.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/fop/samples/cache-test/xsp-sample-to-fo.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xsp-sample-to-fo.xsl 1 May 2003 14:00:19 -0000 1.1
+++ xsp-sample-to-fo.xsl 2 May 2003 14:05:46 -0000 1.2
@@ -47,12 +47,17 @@
<fo:block space-before="6pt">
<fo:block font-size="24pt">Cocoon FOP caching
test</fo:block>
<xsl:call-template name="explain"/>
- <xsl:element name="fo:block"
use-attribute-sets="title">
- Original output from the XSP page
- </xsl:element>
- <fo:block color="grey">
+
+ <fo:block border="solid grey 1px" padding="1em">
+ <xsl:element name="fo:block"
use-attribute-sets="title">
+ Original output from the XSP page
+ </xsl:element>
+ <fo:block font-style="italic">
+ The test links below are not processed in
the PDF version of this sample.
+ </fo:block>
<xsl:apply-templates/>
</fo:block>
+
<xsl:element name="fo:block"
use-attribute-sets="title">
Dummy pages
</xsl:element>
@@ -63,6 +68,7 @@
<xsl:call-template name="repeatPages">
<xsl:with-param name="nPages" select="$pages"/>
</xsl:call-template>
+
<fo:block id="lastBlock">
End of test document
</fo:block>
@@ -96,33 +102,25 @@
What's this?
</xsl:element>
<fo:block>
- This sample takes the output of the XSP cacheable sample and
allows you
+ This sample reuses the XSP cacheable sample page and allows you
to test caching all the way up to PDF generation.
</fo:block>
<fo:block>
- Note that I haven't been able to get PDF caching to work yet,
I'm checking
- this sample in to have a reference for testing. Currently I see
(from the timestamps
- written in the generated XML) that the XSP output is indeed
cached, but the sitemap
- log shows that the FOP conversion runs for every request.
+ Note that I was unable to get caching to work when using the
cocoon:/
+ protocol and the FileGenerator to access the output of the XSP
sample.
+ Using the XSP page directly with the serverpages generator works.
</fo:block>
<xsl:element name="fo:block" use-attribute-sets="title">
How to test the cache
</xsl:element>
<fo:block>
- Call this page like
- <fo:inline
font-style="italic">cache-test-keyA-xyz-1500.pdf</fo:inline>,
- and use the information shown in
+ Call this page as described below and use the information shown
in
<fo:inline color="red">red</fo:inline> under
<fo:inline font-style="italic">original output</fo:inline>
below to check that the cache is working.
</fo:block>
<fo:block>
- In the above filename, <fo:inline
font-style="italic">keyA</fo:inline> is the key used
- to store the content generated by the XSP page in cache, and
<fo:inline font-style="italic">1500
- </fo:inline>is the number of pages to generate in the output PDF.
- </fo:block>
- <fo:block>
The sitemap log (or whatever log the FOPSerializer is configured
to write to) can also
be used to tell if FOP is converting the data or if its being
served from the Cocoon cache.
</fo:block>
@@ -131,8 +129,7 @@
<fo:inline font-style="italic">pageKey</fo:inline> should cause
different versions of the document to be cached.
</fo:block>
<fo:block>
- Increase the
- <fo:inline font-style="italic">pages</fo:inline> parameter to
have FOP take longer to generate the document if needed.
+ The number at the end of the page name is the number of pages to
generate in the output PDF.
</fo:block>
</xsl:template>
@@ -156,4 +153,4 @@
</xsl:template>
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file
1.3 +4 -4 cocoon-2.1/src/blocks/fop/samples/misc/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/fop/samples/misc/samples.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- samples.xml 1 May 2003 14:00:19 -0000 1.2
+++ samples.xml 2 May 2003 14:05:46 -0000 1.3
@@ -15,11 +15,11 @@
</group>
<group name="XSP + FOP caching test">
- <sample name="Generate PDF with pageKey=ONE"
href="cache-test-ONE-a-250.pdf">
- Needs the XSP block to generate input, see generated document
for info.
+ <sample name="PDF with pageKey=ONE, 250 pages"
href="cache-test-250.pdf?pageKey=ONE&other=xyz&validity=60">
+ Needs the serverpages generator to generate input, see generated
document or sitemap for info.
</sample>
- <sample name="Same with pageKey=TWO" href="cache-test-TWO-b-225.pdf">
- Same with another pageKey to check that both are cached
separately.
+ <sample name="PDF with pageKey=TWO, 125 pages"
href="cache-test-125.pdf?pageKey=TWO&validity=45">
+ Uses a different pageKey value to check that both are cached
separately.
</sample>
</group>