cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgaw...@apache.org
Subject svn commit: r447425 - in /cocoon/trunk/blocks/cocoon-template/cocoon-template-sample: ./ src/main/resources/COB-INF/ src/main/resources/COB-INF/view/
Date Mon, 18 Sep 2006 15:07:50 GMT
Author: lgawron
Date: Mon Sep 18 08:07:49 2006
New Revision: 447425

URL: http://svn.apache.org/viewvc?view=rev&rev=447425
Log:
A few JXTG caching samples

Added:
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
  (with props)
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
  (with props)
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/pom.xml
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/welcome.xml

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/pom.xml?view=diff&rev=447425&r1=447424&r2=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/pom.xml Mon Sep 18 08:07:49
2006
@@ -32,6 +32,52 @@
   <version>1.0.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>Template Block Samples</name>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.cocoon</groupId>
+				<artifactId>cocoon-deployer-plugin</artifactId>
+				<version>1.0.0-M2-SNAPSHOT</version>
+			</plugin>
+			<plugin>
+				<groupId>org.mortbay.jetty</groupId>
+				<artifactId>maven-jetty6-plugin</artifactId>
+				<version>6.0.0beta10</version>
+				<configuration>
+					<connectors>
+						<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+							<port>8888</port>
+							<maxIdleTime>30000</maxIdleTime>
+						</connector>
+					</connectors>
+					<webAppSourceDirectory>target/${artifactId}-${version}</webAppSourceDirectory>
+					<contextPath>/</contextPath>
+					<systemProperties>
+						<systemProperty>
+							<name>org.apache.cocoon.mode</name>
+							<value>dev</value>
+						</systemProperty>
+						<systemProperty>
+							<name>org.apache.commons.logging.Log</name>
+							<value>org.apache.commons.logging.impl.SimpleLog</value>
+						</systemProperty>
+						<systemProperty>
+							<name>org.apache.commons.logging.simplelog.defaultlog</name>
+							<value>info</value>
+						</systemProperty>
+						<systemProperty>
+							<name>org.apache.commons.logging.simplelog.showlogname</name>
+							<value>true</value>
+						</systemProperty>
+						<systemProperty>
+							<name>org.apache.commons.logging.simplelog.showShortLogname</name>
+							<value>false</value>
+						</systemProperty>
+					</systemProperties>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
   <dependencies>
     <dependency>
       <groupId>org.apache.cocoon</groupId>

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=447425&r1=447424&r2=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/sitemap.xmap
Mon Sep 18 08:07:49 2006
@@ -46,27 +46,16 @@
         </map:transform>
         <map:serialize/>
       </map:match>
-      <map:match pattern="java/*">
-        <map:generate src="java/{1}.xsp" type="serverpages"/>
+      <map:match pattern="view/*">
+        <map:generate src="view/{1}.jx" type="jx"/>
         <map:transform src="context://samples/blocks/dynamic-page2html.xsl">
           <map:parameter name="servletPath" value="{request:servletPath}"/>
           <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
           <map:parameter name="contextPath" value="{request:contextPath}"/>
-          <map:parameter name="file" value="xsp/{1}.xsp"/>
+          <map:parameter name="file" value="view/{1}.jx"/>
           <map:parameter name="remove" value="{0}"/>
         </map:transform>
         <map:serialize/>
-      </map:match>
-    </map:pipeline>
-	<map:pipeline internal-only="true">
-      <map:match pattern="view-source">
-        <!-- colourize files that are known to be XML -->
-        <map:match type="filename" pattern="((xml)|(xsp)|(xmap)|(xconf))$">
-          <map:generate src="util/view-source.xsp" type="serverpages"/>
-          <map:serialize/>
-        </map:match>
-        <!-- all other files are just send as text -->
-        <map:read mime-type="text/plain" src="../{request-param:filename}"/>
       </map:match>
     </map:pipeline>
   </map:pipelines>

Added: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx?view=auto&rev=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
(added)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
Mon Sep 18 08:07:49 2006
@@ -0,0 +1,27 @@
+<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"  jx:cache-key="abc" jx:cache-validity="${Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}">
+	<title>JX Caching</title>
+	<content>
+		<p>
+			This content has been generated at <jx:formatDate value="${java.util.Calendar.getInstance().getTime()}"
pattern="yyyy-MM-dd HH:mm:ss"/><br/>
+		</p>
+		<p>
+			Caching configuration is <b>jx:cache-key=&quot;abc&quot;
+			jx:cache-validity=&quot;$ {Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}&quot;</b>
+		</p>
+
+		<p>
+			This means that once the content is generated it never expires (NOPValidity) and be served
the same for any parameter combination (cache-key is static).<br/>
+			The content WILL expire if the template source has been changed.
+		</p>
+
+		<p>
+			You may try to <a href="">reload the page</a> and see if generation date changes.<br/>
+			You may try to <a href="?foo=bar">define additional request parameters</a>
to see that it does not change a thing.
+		</p>
+
+		<p>
+			Next sample: <a href="../view/caching2">Request parameter based caching</a>.<br/>
+			Go <a href="../">back</a> to Cocoon Template samples.
+		</p>
+	</content>
+</page>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching1.jx
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx?view=auto&rev=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
(added)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
Mon Sep 18 08:07:49 2006
@@ -0,0 +1,30 @@
+<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"  jx:cache-key="${cocoon.request.parameters.foo}"
jx:cache-validity="${Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}">
+    <title>JX Caching</title>
+    <content>
+        <p>
+            This content has been generated at <jx:formatDate value="${java.util.Calendar.getInstance().getTime()}"
pattern="yyyy-MM-dd HH:mm:ss"/><br/>
+            'foo' request parameter: ${cocoon.request.parameters.foo}
+        </p>
+        <p>
+            Caching configuration is <b>jx:cache-key=&quot;$ {cocoon.request.parameters.foo}&quot;
+            jx:cache-validity=&quot;$ {Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}&quot;</b>
+        </p>
+
+        <p>
+            The content will be cached separately for each value of request parameter named
'foo'.
+            Once the content is generated it never expires (unless the template source changes).
+        </p>
+
+        <p>
+            You may try to <a href="">reload the page</a> and see if generation
date changes.<br/>
+            Try other 'foo' values: <a href="?">not defined</a>, <a href="?foo=">empty</a>,
+            <a href="?foo=bar">bar</a>, <a href="?foo=zoo">zoo</a>
and watch document generation date.<br/>
+            When the 'foo' parameter is not defined the page does NOT get cached (TBD: why?).
+        </p>
+
+        <p>
+            Next sample: <a href="../view/caching3">Caching with all request parameters</a>.<br/>
+            Go <a href="../">Back</a> to Cocoon Template samples.
+        </p>
+    </content>
+</page>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching2.jx
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx?view=auto&rev=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
(added)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
Mon Sep 18 08:07:49 2006
@@ -0,0 +1,32 @@
+<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"  jx:cache-key="${cocoon.request.parameters.toString()}"
jx:cache-validity="${Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}">
+    <title>JX Caching</title>
+    <content>
+        <p>
+            This content has been generated at <jx:formatDate value="${java.util.Calendar.getInstance().getTime()}"
pattern="yyyy-MM-dd HH:mm:ss"/><br/>
+            Request parameters: ${cocoon.request.parameters}
+        </p>
+        <p>
+            Caching configuration is <b>jx:cache-key=&quot;$ {cocoon.request.parameters.toString()}&quot;
+            jx:cache-validity=&quot;$ {Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}&quot;</b>
+        </p>
+
+        <p>
+            The content will be cached separately for any combination of request parameters.
+            Once the content is generated it never expires (unless the template source changes).<br/>
+            You have to use $ {cocoon.request.parameters.toString()} instead of $ {cocoon.request.parameters}
because the cache-key needs to be Serializable.
+        </p>
+
+        <p>
+            Try some combinations:<br/>
+            <a href="">Reload the page</a><br/>
+            See <a href="?foo=bar">?foo=bar</a><br/>
+            See <a href="?foo=bar&amp;bar=foo">?foo=bar&amp;bar=foo</a><br/>
+            See <a href="?bar=foo&amp;foo=bar">?bar=foo&amp;foo=bar</a>
(Luckily the request parameters' order is irrelevant. TBD: can we rely on such functionality?)<br/>
+        </p>
+
+        <p>
+            Next sample: none.<br/>
+            Go <a href="../">Back</a> to Cocoon Template samples.
+        </p>
+    </content>
+</page>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/view/caching3.jx
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/welcome.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/welcome.xml?view=diff&rev=447425&r1=447424&r2=447425
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/welcome.xml
(original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-sample/src/main/resources/COB-INF/welcome.xml
Mon Sep 18 08:07:49 2006
@@ -22,4 +22,9 @@
   <sample name="Back" href="../..">to Cocoon Samples main page</sample>
   <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
  </group>
+ <group name="Caching">
+  <sample name="Static caching" href="view/caching1">Static caching</sample>
+  <sample name="Request parameter based caching" href="view/caching2">Request parameter
based caching</sample>
+  <sample name="Request parameter based caching" href="view/caching3">Caching with
all request parameters</sample>
+ </group>
 </samples>



Mime
View raw message