You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gr...@locus.apache.org on 2000/11/20 19:04:42 UTC

cvs commit: xml-cocoon/xdocs xspprocessor.xml caching.xml

greenrd     00/11/20 10:04:42

  Modified:    .        changes.xml
               src/org/apache/cocoon/processor/xsp xsp-java.xsl
               src/org/apache/cocoon/processor/xsp/library/java util.xsl
               xdocs    xspprocessor.xml caching.xml
  Log:
  renamed xsp:cacheable to util:cacheable on request of Matt Sergeant
  
  Revision  Changes    Path
  1.151     +5 -0      xml-cocoon/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/changes.xml,v
  retrieving revision 1.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- changes.xml	2000/11/20 01:43:51	1.150
  +++ changes.xml	2000/11/20 18:04:39	1.151
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes   
  -  $Id: changes.xml,v 1.150 2000/11/20 01:43:51 greenrd Exp $ 
  +  $Id: changes.xml,v 1.151 2000/11/20 18:04:39 greenrd Exp $ 
   -->
   
   <changes title="History of Changes">
  @@ -18,6 +18,11 @@
     </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="RDG" type="update" due-to="Matt Sergeant"
  +   due-to-email="matt@sergeant.org">
  +   Renamed xsp:cacheable to util:cacheable because this is Cocoon-specific
  +   and should not be part of the core XSP namespace.
  +  </action>
     <action dev="RDG" type="update">
      New caching interface introduced - org.apache.cocoon.framework.Cacheable
      and corresponding xsp tag xsp:cacheable. Incomplete cacheing documentation
  
  
  
  1.22      +0 -6      xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl
  
  Index: xsp-java.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- xsp-java.xsl	2000/11/20 01:43:56	1.21
  +++ xsp-java.xsl	2000/11/20 18:04:40	1.22
  @@ -93,12 +93,6 @@
         /* User Class Declarations */
         <xsl:apply-templates select="xsp:logic" />
   
  -      <xsl:if test="xsp:structure/xsp:cacheable">
  -        public boolean isCacheable (HttpServletRequest request) {
  -          return true;
  -        }
  -      </xsl:if>
  -
         public void populateDocument(
           HttpServletRequest request,
           HttpServletResponse response,
  
  
  
  1.20      +41 -0     xml-cocoon/src/org/apache/cocoon/processor/xsp/library/java/util.xsl
  
  Index: util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/java/util.xsl,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- util.xsl	2000/10/15 22:57:24	1.19
  +++ util.xsl	2000/11/20 18:04:40	1.20
  @@ -72,6 +72,47 @@
       </xsp:page>
     </xsl:template>
   
  +  <!-- Mark page as cacheable -->
  +  <xsl:template match="xsp:structure/util:cacheable">
  +    <xsp:logic>
  +      public boolean isCacheable (HttpServletRequest request) {
  +        return true;
  +      }
  +    </xsp:logic>
  +  </xsl:template>
  +
  +  <!-- Multiline string (based on code by JQ)  - DOESN'T WORK YET!
  +  <xsl:template match="util:string">
  +    <xsl:choose>
  +      <xsl:when test="contains(., '
  +') or contains(.,
  +'
  +')">
  +        <xsl:call-template name="get-nested-strings">
  +          <xsl:with-param name="content" select="."/>
  +        </xsl:call-template>
  +      </xsl:when>
  +      <xsl:otherwise>"<xsl:value-of select="."/>"</xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xsl:template name="get-nested-strings">
  +    <xsl:param name="content"/>
  +      <xsl:variable name="first" select="substring-before($content, '
  +')"/>
  +      <xsl:variable name="rest" select="substring-after($content, '
  +')"/>
  +      <xsl:text>"</xsl:text><xsl:value-of select="$first"/><xsl:text>"</xsl:text>
  +      <xsl:if test="$rest">
  +        <xsl:text> + "\n" +
  +</xsl:text>
  +        <xsl:call-template name="get-nested-strings">
  +          <xsl:with-param name="content" select="$rest"/>
  +        </xsl:call-template>
  +      </xsl:if>
  +  </xsl:template>
  +  -->
  +
     <!-- Include URL contents as DOM -->
     <xsl:template match="util:include-uri">
       <xsl:variable name="href">
  
  
  
  1.9       +20 -0     xml-cocoon/xdocs/xspprocessor.xml
  
  Index: xspprocessor.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/xdocs/xspprocessor.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- xspprocessor.xml	2000/10/15 22:40:11	1.8
  +++ xspprocessor.xml	2000/11/20 18:04:41	1.9
  @@ -713,6 +713,26 @@
           </p>
         </s2>
   
  +      <s2 title="Cache Control">
  +       <p>Also in the &lt;xsp:structure&gt; tag, a &lt;util:cacheable/&gt;
  +        tag may be defined. This empty tag simply allows the page to be
  +        cached. This should always be combined with a method declaration as
  +        follows:</p>
  +
  +       <source>
  +        &lt;xsp:logic&gt;
  +          public boolean hasChanged (Object context) {
  +            // context is a HttpServletRequest
  +            return // whether the page has changed.
  +          }
  +        &lt;/xsp:logic&gt;
  +       </source>
  +
  +       <p>Please read the guide to <connect href="caching.xml">Cocoon caching</connect>
  +        for more information. See also the next section for details on 
  +        declaring methods.</p>
  +      </s2>
  +
         <s2 title="Class-level logic">
           <p>
             In general, XSP class-level declarations (such as instance
  
  
  
  1.2       +3 -3      xml-cocoon/xdocs/caching.xml
  
  Index: caching.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/xdocs/caching.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- caching.xml	2000/11/20 01:44:00	1.1
  +++ caching.xml	2000/11/20 18:04:42	1.2
  @@ -105,10 +105,10 @@
        <td>XSP</td>
        <td>"Processor"/"Producer"</td>
        <td>By default, yes; however, XSP pages can override this by putting
  -      <code>&lt;xsp:cacheable/&gt;</code> within <code>&lt;xsp:structure&gt;
  +      <code>&lt;util:cacheable/&gt;</code> within <code>&lt;xsp:structure&gt;
         </code> (see XSP documentation.)
        </td>
  -     <td>Not applicable if xsp:cacheable tag is missing, since page will
  +     <td>Not applicable if util:cacheable tag is missing, since page will
         never be cached. Otherwise, define the <code>public boolean hasChanged
         (Object context)</code> method to define cache invalidation behaviour.
         Always returning <code>false</code> will never invalidate, for example. 
  @@ -179,7 +179,7 @@
       Since the root of the directory (?node=1) is requested so frequently, it
       makes sense to cache the transformed representation (HTML) of this 
       and other popular nodes. Assuming you are using
  -    XSP, you can simply declare <code>&lt;xsp:cacheable/&gt;</code> and the
  +    XSP, you can simply declare <code>&lt;util:cacheable/&gt;</code> and the
       following method:
      </p>