vgritsenko 02/02/01 20:13:11 Modified: src/webapp/docs/samples/xsp aggregate.xsp Added: src/webapp/docs/samples/xsp cacheable.xsp Log: samples Revision Changes Path 1.3 +4 -4 xml-cocoon2/src/webapp/docs/samples/xsp/aggregate.xsp Index: aggregate.xsp =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/docs/samples/xsp/aggregate.xsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate.xsp 24 Jan 2002 08:55:00 -0000 1.2 +++ aggregate.xsp 2 Feb 2002 04:13:11 -0000 1.3 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<!-- CVS: $Id: aggregate.xsp,v 1.2 2002/01/24 08:55:00 cziegeler Exp $ --> +<!-- CVS: $Id: aggregate.xsp,v 1.3 2002/02/02 04:13:11 vgritsenko Exp $ --> <xsp:page language="java" @@ -22,13 +22,13 @@ <title>A Simple XSP Page using Content Aggregation</title> <content> <para> - <cinclude:include src="slashdot/slashdot.xml" element="slashdot" ns="http://foo.bar.com/slashdot"/> + <cinclude:include src="news/slashdot.xml" element="slashdot" ns="http://foo.bar.com/slashdot"/> </para> <para> - <cinclude:include src="moreover/moreover.xml" element="moreover" ns="http://foo.bar.com/moreover"/> + <cinclude:include src="news/moreover.xml" element="moreover" ns="http://foo.bar.com/moreover"/> </para> <para> - <cinclude:include src="isyndicate/news.xml" element="isyndicate" ns="http://foo.bar.com/isyndicate"/> + <cinclude:include src="news/news.xml" element="isyndicate" ns="http://foo.bar.com/isyndicate"/> </para> <para>Brought to you by Cocoon at <xsp:expr>new Date()</xsp:expr>.</para> </content> 1.1 xml-cocoon2/src/webapp/docs/samples/xsp/cacheable.xsp Index: cacheable.xsp =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-request="http://apache.org/xsp/request/2.0"> <xsp:structure> <xsp:include>org.apache.cocoon.caching.CacheValidity</xsp:include> <xsp:include>org.apache.cocoon.caching.DeltaTimeCacheValidity</xsp:include> <xsp:include>org.apache.cocoon.util.HashUtil</xsp:include> </xsp:structure> <xsp:logic> private static final String className = getClass().getName(); /** * Generate the unique key. * This key must be unique inside the space of the all XSP pages. * This method will be invoked before the generateValidity() method. * * @return The generated key or 0 if the component * is currently not cacheable. */ public long generateKey() { // Generate unique key; add parameters' values here return HashUtil.hash(getClass().getName() + request.getParameter("param")); } /** * Generate the validity object. * Before this method can be invoked the generateKey() method * will be invoked. * * @return The generated validity object or null if the * component is currently not cacheable. */ public CacheValidity generateValidity() { // Check all dependencies here return new DeltaTimeCacheValidity(0, 5); } </xsp:logic> <page> <title>A Cacheable XSP Page</title> <content> <para>Hi there! I'm a simple dynamic page generated by XSP (eXtensible Server Pages).</para> <para>I'm cached for every different value of request parameter 'param'. Value is: <b> <xsp-request:get-parameter name="param"/> </b></para> <para>All other request parameters do not influence cache status, but my validity will expire after 5 sec (see source). Value of parameter 'other' is: <b> <xsp-request:get-parameter name="other"/></b> </para> <para>Links: <ul> <li><a href="cacheable?param=one">param=one</a></li> <li><a href="cacheable?param=two">param=two</a></li> <li><a href="cacheable?param=three&other=abc">param=three, other=abc</a></li> <li><a href="cacheable?param=three&other=xyz">param=three, other=xyz</a></li> </ul> Try two last links with delay 5 sec; and try without delay. </para> </content> </page> </xsp:page>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]