stevenn 2003/05/25 12:25:07
Modified: src/documentation/xdocs/userdocs/flow api.xml
continuations.xml how-does-it-work.xml index.xml
jpath.xml jxtemplate.xml sitemap.xml using.xml
velocity.xml views.xml
Log:
fixed quite some validation errors and made doctype declaration consistent
Revision Changes Path
1.8 +29 -29 cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml
Index: api.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- api.xml 25 May 2003 01:16:31 -0000 1.7
+++ api.xml 25 May 2003 19:25:06 -0000 1.8
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
@@ -45,50 +45,50 @@
<s1 title="Objects">
<s2 title = "cocoon">
<p>The <code>cocoon</code> object represents the current Cocoon sitemap
and provides the following readonly properties:</p>
- <s4 title="request">
+ <s3 title="request">
<p>The current Cocoon request:</p>
<p>
<em>Property</em> <code>[org.apache.cocoon.environment.Request]
request</code>
</p>
- </s4>
- <s4 title="response">
+ </s3>
+ <s3 title="response">
<p>The current Cocoon response:</p>
<p>
<em>Property</em> <code>[org.apache.cocoon.environment.Response]
response</code>
</p>
- </s4>
- <s4 title="session">
+ </s3>
+ <s3 title="session">
<p>The current Cocoon session:</p>
<p>
<em>Property</em> <code>[org.apache.cocoon.environment.Session]
session</code>
</p>
- </s4>
- <s4 title="context">
+ </s3>
+ <s3 title="context">
<p>The current Cocoon application context:</p>
<p>
<em>Property</em> <code>[org.apache.cocoon.environment.Context]
context</code>
</p>
- </s4>
- <s4 title="environment">
+ </s3>
+ <s3 title="environment">
<p>The current Cocoon environment:</p>
<p>
<em>Property</em> <code>[org.apache.cocoon.environment.Environment]
environment</code>
</p>
- </s4>
- <s4 title="componentManager">
+ </s3>
+ <s3 title="componentManager">
<p>The current Sitemap's component manager:</p>
<p>
<em>Property</em>
<code>[org.apache.avalon.framework.component.ComponentManager]
componentManager</code>
</p>
- </s4>
- <s4 title="parameters">
+ </s3>
+ <s3 title="parameters">
<p>Any parameters passed to the script by the Sitemap:</p>
<p>
<em>Property</em> <code>[Array] parameters</code>
</p>
<p>The <code>cocoon</code> object also provides the following
functions:</p>
- </s4>
- <s4 title="process">
+ </s3>
+ <s3 title="process">
<p>
<em>Function</em> <code>[Boolean] process([String] uri, [Object]
bizData, [java.io.OutputStream] stream)</code></p>
<p>
@@ -100,8 +100,8 @@
<p><code>stream</code> is an <code>OutputStream</code> where the output
should be written to.</p>
<p>Returns the result from the Cocoon processor.
</p>
- </s4>
- <s4 title="createSession"><anchor id="createSession"/>
+ </s3>
+ <s3 title="createSession"><anchor id="createSession"/>
<p> <em>Function</em> <code>createSession()</code></p>
<p>
@@ -110,22 +110,22 @@
function="..."></link>), will share global JavaScript variables.
</p>
- </s4>
- <s4 title="removeSession">
+ </s3>
+ <s3 title="removeSession">
<p>
<em>Function</em> <code>removeSession()</code>
</p>
<p>
Dissociate global JavaScript variables from the user's session.
</p>
- </s4>
- <s4 title="load">
+ </s3>
+ <s3 title="load">
<p><em>Function</em> <code>load([String] uri)</code></p>
<p>
Load the JavaScript script specified by <code>uri</code>. The Cocoon
source resolver is used to resolve <code>uri</code>.
</p>
- </s4>
+ </s3>
</s2>
<s2 title="WebContinuation"><anchor id="WebContinuation"/>
<p>A <code>WebContinuation</code> represents a continuation of a
Flowscript. Because a user may click on the back button in the browser and
restart a saved computation in a continuation, each
<code>WebContinuation</code> becomes the parent of a subtree of continuations.
@@ -136,7 +136,7 @@
<p>
<code>WebContinuation</code> objects support the following functions
and properties:
</p>
- <s4 title="getContinuation">
+ <s3 title="getContinuation">
<p>
<em>Function</em> <code>[WebContinuation] getContinuation([Number]
level)</code>
</p>
@@ -149,8 +149,8 @@
the depth of the tree, the root of the tree is returned.
</p>
- </s4>
- <s4 title="invalidate">
+ </s3>
+ <s3 title="invalidate">
<p>
<em>Function</em> <code>invalidate()</code>
</p>
@@ -161,15 +161,15 @@
<code>WebContinuation</code> invalidates all the
<code>WebContinuation</code>s which are children of it.
</p>
- </s4>
- <s4 title="id">
+ </s3>
+ <s3 title="id">
<p>
<em>Property</em> <code>[String] id</code>
</p>
<p>
Returns the unique string identifier of this continuation
</p>
- </s4>
+ </s3>
</s2>
</s1>
</body>
1.3 +1 -1
cocoon-2.1/src/documentation/xdocs/userdocs/flow/continuations.xml
Index: continuations.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/continuations.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- continuations.xml 24 May 2003 18:51:26 -0000 1.2
+++ continuations.xml 25 May 2003 19:25:06 -0000 1.3
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
1.3 +1 -1
cocoon-2.1/src/documentation/xdocs/userdocs/flow/how-does-it-work.xml
Index: how-does-it-work.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/how-does-it-work.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- how-does-it-work.xml 24 May 2003 18:51:26 -0000 1.2
+++ how-does-it-work.xml 25 May 2003 19:25:06 -0000 1.3
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
1.3 +1 -1
cocoon-2.1/src/documentation/xdocs/userdocs/flow/index.xml
Index: index.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/index.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- index.xml 25 May 2003 04:29:00 -0000 1.2
+++ index.xml 25 May 2003 19:25:06 -0000 1.3
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
1.7 +9 -14
cocoon-2.1/src/documentation/xdocs/userdocs/flow/jpath.xml
Index: jpath.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/jpath.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- jpath.xml 25 May 2003 17:17:40 -0000 1.6
+++ jpath.xml 25 May 2003 19:25:06 -0000 1.7
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
-"../dtd/document-v10.dtd">
+"../../dtd/document-v10.dtd">
<document>
<header>
<title>Advanced Control Flow</title>
@@ -28,13 +28,12 @@
body
</if>
</source>
-<p>Example:
+<p>Example:</p>
<source>
<jpath:if test="cart/numberOfItems = 0">
Your cart is empty
</jpath:if>
</source>
-</p>
</s2>
<s2 title ="choose">
<p>The <code>choose</code> tag performs conditional block execution by the
@@ -53,7 +52,7 @@
</otherwise>?
</choose>
</source>
-<p>Example:
+<p>Example:</p>
<source>
<choose>
<when test="not(user/loggedIn)">
@@ -64,7 +63,6 @@
</otherwise>
</choose>
</source>
-</p>
</s2>
<s2 title="value-of">
<p>The <code>value-of</code> tag evaluates an expression and outputs
@@ -72,40 +70,37 @@
<source>
<value-of select="XPathExpression"/>
</source>
-<p>Example:
+<p>Example:</p>
<source>
<value-of select="cart/numberOfItems">
</source>
-</p>
</s2>
<s2 title="for-each">
<p>The <code>for-each</code> tag allows you to iterate over a collection
-of objects:</p><p>
+of objects:</p>
<source>
<for-each select="XPathExpression">
body
</for-each>
</source>
-<p>When using XPath expressions within <code>for-each</code> the current
element is the context node and can be referenced with:</p>
-<source>.</source></p>
-<p>Example:
+<p>When using XPath expressions within <code>for-each</code> the current
element is the context node and can be referenced with:
+<code>.</code></p>
+<p>Example:</p>
<source>
<for-each select="cart/cartItems[position() <= $count]">
<td><value-of select="./productId"></td>
</for-each>
</source>
-</p>
</s2>
<s2 title="continuation">
<p>The <code>continuation</code> tag returns the id of the current web
continuation of your Flowscript. You can refer to previous continuations by
supplying the optional <code>level</code> attribute. Zero is the current level,
<code>-1</code> refers to the previous continuation, and so on.</p>
<source>
<continuation [level="Number"]/>
</source>
-<p>Example:
+<p>Example:</p>
<source>
<xsp:attribute
name="action"><xsp:expr><jpath:continuation/>+".form"</xsp:expr></xsp:attribute>
</source>
-</p>
</s2>
</s1>
</body>
1.6 +26 -40
cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml
Index: jxtemplate.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- jxtemplate.xml 25 May 2003 17:05:45 -0000 1.5
+++ jxtemplate.xml 25 May 2003 19:25:06 -0000 1.6
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
-"../dtd/document-v10.dtd">
+"../../dtd/document-v10.dtd">
<document>
<header>
<title>Advanced Control Flow</title>
@@ -24,12 +24,11 @@
<source>
<site signOn="${accountForm.signOn}">
</source>
-<p>Embedded Jexl expressions are contained in <source>${}</source></p>
-<p>Embedded JXPath expressions are contained in <source>#{}</source></p>
+<p>Embedded Jexl expressions are contained in <code>${}</code></p>
+<p>Embedded JXPath expressions are contained in <code>#{}</code></p>
<p>The referenced objects may be Java Beans, DOM, JDOM, or JavaScript
objects
from a Flowscript. In addition the following implicit objects are available
as
both JXPath and Jexl variables in a template:</p>
-<p>
<dl>
<dt><code>request</code></dt>
<dd>The current Cocoon request</dd>
@@ -46,35 +45,31 @@
<dt><code>parameters</code></dt>
<dd>Any parameters passed to the generator in the pipeline</dd>
</dl>
-</p>
<p>
-Jexl Example:
+Jexl Example:</p>
<source>
The content type of the current request is ${request.contentType}
</source>
-</p>
<p>
-JXPath Example:
+JXPath Example:</p>
<source>
The content type of the current request is #{$request/contentType}
</source>
-</p>
<p>
The current Web Continuation from the Flowscript
is also available as a variable named <code>continuation</code>. You would
-typically access its <code>id</code>:
+typically access its <code>id</code>:</p>
<source>
<form action="${continuation.id}">
</source>
-</p>
<p>You can also reach previous continuations by using the
<code>getContinuation()</code> function:</p>
<source>
<form action="${continuation.getContinuation(1).id}" >
</source>
-<p>or using an XPath expression:</p><p>
+<p>or using an XPath expression:</p>
<source>
<form action="#{getContinuation($continuation)/id}" >
-</source></p>
+</source>
</s1>
<s1 title ="Tags">
<p>The JXTemplate Generator tags are defined in the namespace</p>
@@ -98,18 +93,16 @@
[body]
</set>
</source><p>If used within a <code>macro</code> definition (see below)
variables created by <code>set</code> are only visible within the body of the
<code>macro</code>.</p>
-<p>Jexl Example:
+<p>Jexl Example:</p>
<source>
<set var="greeting" value="Hello ${user}"/>
${greeting}
</source>
-</p>
-<p>JXPath Example:
+<p>JXPath Example:</p>
<source>
<set var="greeting" value="Hello #{user}"/>
#{$greeting}
</source>
-</p>
</s2>
<s2 title ="if">
<p>The <code>if</code> tag allows the conditional execution of its body
@@ -119,20 +112,18 @@
body
</if>
</source>
-<p>Jexl Example:
+<p>Jexl Example:</p>
<source>
<if test="${cart.numberOfItems == 0}">
Your cart is empty
</if>
</source>
-</p>
-<p>JXPath Example:
+<p>JXPath Example:</p>
<source>
<if test="#{cart/numberOfItems = 0}">
Your cart is empty
</if>
</source>
-</p>
</s2>
<s2 title ="choose">
<p>The <code>choose</code> tag performs conditional block execution by the
@@ -151,7 +142,7 @@
</otherwise>?
</choose>
</source>
-<p>Jexl Example:
+<p>Jexl Example:</p>
<source>
<choose>
<when test="${!user.loggedIn}">
@@ -162,8 +153,7 @@
</otherwise>
</choose>
</source>
-</p>
-<p>JXPath Example:
+<p>JXPath Example:</p>
<source>
<choose>
<when test="#{not(user/loggedIn)}">
@@ -174,7 +164,6 @@
</otherwise>
</choose>
</source>
-</p>
</s2>
<s2 title="out">
<p>The <code>out</code> tag evaluates an expression and outputs
@@ -182,25 +171,23 @@
<source>
<out value="Expression"/>
</source>
-<p>Jexl Example:
+<p>Jexl Example:</p>
<source>
<out value="${cart.numberOfItems}">
</source>
-</p>
-<p>JXPath Example:
+<p>JXPath Example:</p>
<source>
<out value="#{cart/numberOfItems}">
</source>
-</p>
</s2>
<s2 title="forEach">
<p>The <code>forEach</code> tag allows you to iterate over a collection
-of objects:</p><p>
+of objects:</p>
<source>
<forEach [var="Name"] [items="Expression"] [begin="NumExpr"]
[end="NumExpr"] [step="NumExpr"]>
body
</forEach>
-</source></p>
+</source>
<p>The <code>items</code> attribute specifies the list of items to iterate
over. The <code>var</code> attribute specifies the name of a variable to hold
the current item. The <code>begin</code> attribute specifies the element to
start with
(<code>0</code> = first item, <code>1</code> = second item, ...).
If unspecified it defaults to <code>0</code>. The <code>end</code>
@@ -213,22 +200,20 @@
body
</forEach>
</source>
-<p>When using XPath expressions within <code>forEach</code> the current
element is the context node and can be referenced with:</p>
-<source>#{.}</source>
-<p>Jexl Example:
+<p>When using XPath expressions within <code>forEach</code> the current
element is the context node and can be referenced with:
+<code>#{.}</code></p>
+<p>Jexl Example:</p>
<source>
<forEach var="item" items="${cart.cartItems} begin="${start}"
end="${count-start}" step="1"">
<td>${item.productId}</td>
</forEach>
</source>
-</p>
-<p>JXPath Example:
+<p>JXPath Example:</p>
<source>
<forEach items="#{cart/cartItems[position() <= $count]}}>
<td>#{./productId}</td>
</forEach>
</source>
-</p>
</s2>
<s2 title="macro">
<p>The <code>macro</code> tag allows you define a new custom tag.</p><source>
@@ -257,9 +242,10 @@
</c:forEach>
</c:macro>
</source>
-<p>The <code>parameter</code> tags in the macro definition define formal
parameters, which are replaced with the actual attribute values of the tag when
it is used. The content of the tag is also available as a special variable
<code>${content}</code>.</p><p>Assuming you had this code in your
flowscript:</p><p>
- <source><p>var greatlakes = ["Superior", "Michigan", "Huron", "Erie",
"Ontario"];</p><p>sendPage(uri, {greatlakes: greatlakes});</p></source>
-</p><p>and a template like this:</p><source>
+<p>The <code>parameter</code> tags in the macro definition define formal
parameters, which are replaced with the actual attribute values of the tag when
it is used. The content of the tag is also available as a special variable
<code>${content}</code>.</p><p>Assuming you had this code in your
flowscript:</p>
+ <source>var greatlakes = ["Superior", "Michigan", "Huron", "Erie",
"Ontario"];
+ sendPage(uri, {greatlakes: greatlakes});</source>
+<p>and a template like this:</p><source>
<table>
<tablerows list="${greatlakes}" color="blue"/>
</table>
1.5 +5 -15
cocoon-2.1/src/documentation/xdocs/userdocs/flow/sitemap.xml
Index: sitemap.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/sitemap.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sitemap.xml 25 May 2003 17:05:45 -0000 1.4
+++ sitemap.xml 25 May 2003 19:25:07 -0000 1.5
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
@@ -14,21 +14,18 @@
<s1 title="Sitemap">
<p>The Cocoon sitemap includes several elements to specify interactions
with your Flowscripts.</p>
<s2 title="flow">
- <p>The <code>flow</code> element defines a Flowscript interpreter for a
sitemap. The <code>language</code> attribute specifies the target programming
language. Currently the only supported language is <code>"JavaScript"</code>.
Its embedded <code>script</code> elements allow you to specify the files that
make up the flow for this sitemap. Each <code>script</code> element specifies
the URI of a script that will be compiled and executed when this Sitemap is
created. The <code>src</code> attribute specifies the URI of the script.</p><p>
+ <p>The <code>flow</code> element defines a Flowscript interpreter for a
sitemap. The <code>language</code> attribute specifies the target programming
language. Currently the only supported language is <code>"JavaScript"</code>.
Its embedded <code>script</code> elements allow you to specify the files that
make up the flow for this sitemap. Each <code>script</code> element specifies
the URI of a script that will be compiled and executed when this Sitemap is
created. The <code>src</code> attribute specifies the URI of the script.</p>
<source><![CDATA[
<map:flow language="Language">
<map:script src="URI"/>+
</map:flow>
]]></source>
- </p>
-<p>
- Example:
+ <p>Example:</p>
<source><![CDATA[
<map:flow language="JavaScript">
<map:script src="myApplication.js"/>
</map:flow>
]]></source>
-</p>
</s2>
<s2 title="call">
<p>The <code>call</code> element allows you to call a top-level
function in your Flowscript or to invoke an existing continuation.</p>
@@ -39,8 +36,7 @@
<map:parameter name="Name" value="Value"/>*
</map:call>
]]></source>
- <p>
-Example:
+ <p>Example:</p>
<source><![CDATA[
<map:flow language="JavaScript">
<map:script src="myApplication.js"/>
@@ -53,7 +49,6 @@
</map:pipeline>
</map:pipelines>
]]></source>
- </p>
<p>Then in <code>myApplication.js</code> you would define a JavaScript
function called <code>showIndexPage()</code> such as:</p>
<source><![CDATA[
function showIndexPage() {
@@ -61,23 +56,18 @@
sendPage("private/index.html", {param: param});
}
]]></source>
- <p></p>
</s3>
<s3 title="continuation"><anchor id="callContinuation"/>
<p>If the <code>continuation</code> attribute is present, then the
Sitemap will invoke an existing continuation of your Flowscript. The
<code>continuation</code> attribute specifies the unique id of the
continuation.</p>
- <p>
<source><![CDATA[
<map:call continuation="Id"/>
]]></source>
- </p>
- <p>
-Example:
+ <p>Example:</p>
<source><![CDATA[
<map:match pattern="*.form">
<map:call continuation="{1}"/>
</map:match>
]]></source>
- </p>
</s3>
</s2>
</s1>
1.5 +56 -58
cocoon-2.1/src/documentation/xdocs/userdocs/flow/using.xml
Index: using.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/using.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- using.xml 25 May 2003 18:17:07 -0000 1.4
+++ using.xml 25 May 2003 19:25:07 -0000 1.5
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
@@ -19,37 +19,36 @@
<p>
The request is received by Cocoon and passed to the sitemap for
processing. In the sitemap, you can do two things to pass the control to
- the Control Flow layer:
- <ul>
- <li>
- You can invoke a JavaScript top-level function to start processing a
- logically grouped sequences of pages. Each time a response page is
- being sent back to the client browser from this function, the
- processing of the JavaScript code stops at the point the page is
- sent back, and the HTTP request finishes. Through the magic of
- continuations, the execution state is saved in a continuation object.
- Each continuation is given a unique string id, which could be
embedded
- in generated page, so that you can restart the saved computation
later
- on.
- </li>
- <li>
- To invoke a top level JavaScript function in the Control Flow, you
use
- the <code><link
href="sitemap.html#callFunction"><map:call function="function-name"/></link></code>
- construction.
- </li>
- <li>
- To restart the computation of a previously stopped function, you use
- the <code><link
href="sitemap.html#callContinuation"><map:call continuation="..."/></link></code>
construction.
- This restarts the computation saved in a continuation object
- identified by the string value of the <code>continuation</code>
attribute.
- This value could be extracted in the sitemap from the requested URL,
- from a POST or GET parameter etc. When the computation stored in the
- continuation object is restarted, it appears as if nothing happened,
- all the local and global variables have exactly the same values as
- they had when the computation was stopped.
- </li>
- </ul>
- </p>
+ the Control Flow layer:</p>
+ <ul>
+ <li>
+ You can invoke a JavaScript top-level function to start processing a
+ logically grouped sequences of pages. Each time a response page is
+ being sent back to the client browser from this function, the
+ processing of the JavaScript code stops at the point the page is
+ sent back, and the HTTP request finishes. Through the magic of
+ continuations, the execution state is saved in a continuation object.
+ Each continuation is given a unique string id, which could be embedded
+ in generated page, so that you can restart the saved computation later
+ on.
+ </li>
+ <li>
+ To invoke a top level JavaScript function in the Control Flow, you use
+ the <link
href="sitemap.html#callFunction"><code><map:call function="function-name"/></code></link>
+ construction.
+ </li>
+ <li>
+ To restart the computation of a previously stopped function, you use
+ the <link
href="sitemap.html#callContinuation"><code><map:call continuation="..."/></code></link>
construction.
+ This restarts the computation saved in a continuation object
+ identified by the string value of the <code>continuation</code>
attribute.
+ This value could be extracted in the sitemap from the requested URL,
+ from a POST or GET parameter etc. When the computation stored in the
+ continuation object is restarted, it appears as if nothing happened,
+ all the local and global variables have exactly the same values as
+ they had when the computation was stopped.
+ </li>
+ </ul>
<p>
Once the JavaScript function in the control layer is restarted, you're
@@ -69,7 +68,7 @@
<p>
Once here, the Control Flow has to decide which page needs to be sent
back
to the client browser. To do this, the script can invoke either the
- <code><link
href="api.html#sendPageAndWait">sendPageAndWait</link></code> or the
<code><link href="api.html#sendPage">sendPage</link></code> functions.
+ <link
href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link> or the
<link href="api.html#sendPage"><code>sendPage</code></link> functions.
These functions take two parameters, the relative URL of the page to be
sent back to the client, and a context object which can be accessed
inside this page to extract various values and place them in the
@@ -112,25 +111,24 @@
View a context object constructed from Model data.
</p>
- <h4>Basic usage</h4>
+ <s2 title="Basic usage">
<p>
As hinted in the previous section, an application using Cocoon's MVC
- approach is composed of three layers:
- <ul>
- <li>
- A JavaScript controller which implements the interaction with the
- client
- </li>
- <li>
- The business logic model which implements your application
- </li>
- <li>
- The page templates, which describe the content of the pages, and XSLT
- stylesheets which describe the look of the content.
- </li>
- </ul>
- </p>
+ approach is composed of three layers:</p>
+ <ul>
+ <li>
+ A JavaScript controller which implements the interaction with the
+ client
+ </li>
+ <li>
+ The business logic model which implements your application
+ </li>
+ <li>
+ The page templates, which describe the content of the pages, and XSLT
+ stylesheets which describe the look of the content.
+ </li>
+ </ul>
<p>
In more complex applications, the flow of pages can be thought of smaller
@@ -145,14 +143,13 @@
</p>
<p>
- This application is composed of four top-level JavaScript functions:
- <ul>
- <li><code>login</code>,</li>
- <li><code>registerUser</code>,</li>
- <li><code>edit</code> and</li>
- <li><code>logout</code>.</li>
- </ul>
- </p>
+ This application is composed of four top-level JavaScript functions:</p>
+ <ul>
+ <li><code>login</code>,</li>
+ <li><code>registerUser</code>,</li>
+ <li><code>edit</code> and</li>
+ <li><code>logout</code>.</li>
+ </ul>
<p>
The entry level point in the application can be any of these functions,
@@ -175,11 +172,12 @@
<p>
To solve the problem, the <code>login</code> and
<code>registerUser</code> functions have to call the
- <code><link
href="api.html#createSession">cocoon.createSession()</link></code> method,
which creates a servlet
+ <link
href="api.html#createSession"><code>cocoon.createSession()</code></link>
method, which creates a servlet
session and saves the global scope containing the global variables' value
in it. Next time the user invokes one of the four top-level functions,
the values of the global variables is restored, making sharing very easy.
</p>
+ </s2>
<p>
Even if you don't need complex control flow in your application, you may
1.4 +4 -11
cocoon-2.1/src/documentation/xdocs/userdocs/flow/velocity.xml
Index: velocity.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/velocity.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- velocity.xml 25 May 2003 01:05:22 -0000 1.3
+++ velocity.xml 25 May 2003 19:25:07 -0000 1.4
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
-"../dtd/document-v10.dtd">
+"../../dtd/document-v10.dtd">
<document>
<header>
<title>Advanced Control Flow</title>
@@ -14,22 +14,17 @@
<p>
If called from a Flowscript, the Cocoon <link
href="http://jakarta.apache.org/velocity">Velocity</link> Generator provides
access to the immediate properties of the context object passed to
<code>sendPage</code> and <code>sendPageAndWait</code>. In that case, the
current <code>WebContinuation</code> is also available as a variable named
<code>$continuation</code>
You would
-typically access its <code>id</code>:
+typically access its <code>id</code>:</p>
<source>
-<pre>
<form action="$continuation.id">
-</pre>
</source>
<p>You can also reach previous continuations by using the
<code>getContinuation()</code> function:</p>
<source>
-<pre>
<form action="$continuation.getContinuation(1).id" >
-</pre>
</source>
-In addition the following implicit objects are always available in
-the Velocity context:
-<p>
+<p>In addition the following implicit objects are always available in
+the Velocity context:</p>
<dl>
<dt><code>$request</code>
(<code>org.apache.cocoon.environment.Request</code>)</dt>
<dd>The current Cocoon request</dd>
@@ -46,8 +41,6 @@
<dt><code>$parameters</code>
(<code>org.apache.avalon.framework.parameters.Parameters</code>)</dt>
<dd>Any parameters passed to the generator in the pipeline</dd>
</dl>
-</p>
- </p>
</s1>
</body>
</document>
1.3 +1 -1
cocoon-2.1/src/documentation/xdocs/userdocs/flow/views.xml
Index: views.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/views.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- views.xml 25 May 2003 00:48:47 -0000 1.2
+++ views.xml 25 May 2003 19:25:07 -0000 1.3
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../../WEB-INF/entities/document-v10.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>