cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Green <jgr...@dcom-solutions.com>
Subject Caching with XSP (<util:cacheable/>)
Date Tue, 13 Mar 2001 08:52:13 GMT
I'm trying to figure out how to get Cocoon to cache an XSP page (Cocoon 
1.8.2).  I've checked all the documentation, and searched through the 
mail archives, and there is not one single example of a working 
configuration that I can find.  From what I can gather it should cache 
the page if I put the <util:cacheable/> tag withing 
<xsp:structure></xsp:structure>, and if I have a hasChanged(Object 
context) method in the page.  I've tried every combination and placement 
of these that I can think of and nothing works. 

Can someone tell me what I'm missing?  Here is the code for a very bare 
bones page (XML/XSP and XSL) that I'm trying to get to cache.  I'm not 
actually using the XSP to do anything useful, I just need to get it to 
cache so I can use a similar technique on some real pages.

I know that the caching mechanism itself is turned on and working 
because if I comment out all the XSP stuff in the page below, the 
straight XML->(XSL)->HTML transformation is cached. 

cache_test.xml
-----------------------------------------
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>   

<?cocoon-process type="xslt"?>
<?xml-stylesheet href="cache_test.xsl" type="text/xsl" ?>

<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core"
   xmlns:util="http://www.apache.org/1999/XSP/Util"
 >

<xsp:structure>
               <xsp:cacheable/>   
</xsp:structure>
<xsp:logic>
         public boolean hasChanged (Object context) {
               return false;
         }     
</xsp:logic>

<page>   
  <title>
    Cache test
  </title>

  <bodyContent>
    Here is the body content.
  </bodyContent>
</page>

</xsp:page>

------------------------------------------


cache_test.xsl
------------------------------------------
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/page">

<html>
   <head>
       <title><xsl:apply-templates select="title"/></title>
   </head>
   <body>
       <h1><xsl:value-of select="title"/></h1>
      
       <xsl:apply-templates select="bodyContent"/>
   </body>
</html>

</xsl:template>

</xsl:stylesheet>


-----------------------------------------------

I hope someone can tell me what I'm doing wrong here.  I'd really 
appreciate either some pointers on what I've done wrong, or just some 
sample code of one that works.

Thanks in advance,
Jeremy




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message