You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Timothy Larson <Td...@ci.canton.oh.us> on 2002/09/11 21:43:11 UTC

Subject: cocoon 2.0.3 embedded xsp caching problem

I am embedding xsp and xsl into a sitemap file.
Everything works, except when the embedded xsp code is modified.

Then cocoon seems to randomly choose whether or not to start
using the updated xsp code.  Even when the java, class, and
cache files are deleted, no proxies are in use, and the
browser file cache is emptied, the old version continues to be
served.  Repeated saves and requests sometimes cause an update,
but not predictably.  Any ideas how to resolve this?

Environment:
  Windows 2000 Professional
  Internet Explorer 5.5
  Sun JDK 1.3.1_04
  Tomcat 3.3.1
  cocoon 2.0.3
  saxon 7.1

FAQ:
Yes, I realy need to do this.  The idea is to logically separate
the processing steps without multiplying the number of files that
must be maintained.  Separation of concerns will be preserved,
when required, by referencing external files.
No, don't worry, the xsp will NOT be recompiled for every request.
No, it cannot be caused by time slew, because everything is being
done on the same machine.

The contents of the following files are listed below:
  subsitemap for this directory:         "test/sitemap.xmap"
  subsitemap containing xsp and xsl:     "test/sample.xmap"
  stylesheet for extracting xsp and xsl: "test/get.xsl"


<?xml version="1.0"?>
<!-- Filename: test/sitemap.xmap -->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <!-- ======= Components ======= -->
  <map:components>
    <map:generators default="file"/>
    <map:transformers default="xslt-Saxon"/>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:selectors default="browser"/>
    <map:matchers default="wildcard"/>
  </map:components>

  <!-- ======= Pipelines ======= -->
  <map:pipelines>
    <map:pipeline>

      <map:match pattern="*.*">
        <map:act type="resource-exists">
          <map:parameter name="url" value="{1}.xmap"/>
          <map:mount
            check-reload="yes"
            src="{../1}.xmap" uri-prefix=""
            reload-method="synchron"/>
        </map:act>
      </map:match>

    </map:pipeline>
  </map:pipelines>

</map:sitemap>


<?xml version="1.0"?>
<?cocoon-disable-caching?>
<!-- File: test/sample.xmap -->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:components>
    <map:generators default="file"/>
    <map:transformers default="xslt-Saxon"/>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:selectors default="browser"/>
    <map:matchers default="wildcard"/>
  </map:components>

  <map:pipelines>
    <map:pipeline>

      <map:match pattern="*.xsp">
        <map:generate src="{1}.xmap"/>
        <map:transform src="get.xsl">
          <map:parameter name="section" value="xsp-section"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>

      <map:match pattern="*.xsl">
        <map:generate src="{1}.xmap"/>
        <map:transform src="get.xsl">
          <map:parameter name="section" value="xsl-section"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>

      <map:match pattern="*.xml">
        <map:generate src="cocoon:/{1}.xsp" type="serverpages"/>
        <map:transform src="cocoon:/{1}.xsl"/>
        <map:serialize type="xml"/>
      </map:match>

    </map:pipeline>
  </map:pipelines>

  <embed>

    <xsp-section>
      <xsp:page
        xmlns:xsp="http://apache.org/xsp"
        language="java">

        <sample>This is a sample.</sample>

      </xsp:page>
    </xsp-section>

    <xsl-section>
      <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

        <xsl:output method="xml" encoding="UTF-8" indent="yes">

        <xsl:template match="/">
          <styled-sample>
            <xsl:copy>
              <xsl:apply-templates select="node()"/>
            </xsl:copy>
          </styled-sample>
        </xsl:template>

        <xsl:template match="node()">
          <xsl:copy>
            <xsl:apply-templates select="node()"/>
          </xsl:copy>
        </xsl:template>

      </xsl:stylesheet>
    </xsl-section>

  </embed>

</map:sitemap>


<?xml version="1.0"?>
<?cocoon-disable-caching?>
<!-- File: test/get.xsl -->
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <xsl:param name="section"/>

  <xsl:template match="/">
    <xsl:processing-instruction name="cocoon-disable-caching"/>
    <xsl:apply-templates select="map:sitemap/embed/*[name()=$section]/*"/>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>


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

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