cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/documentation/xdocs/userdocs/flow api.xml book.xml continuations.xml how-does-it-work.xml index.xml jpath.xml jxtemplate.xml sitemap.xml using.xml velocity.xml views.xml
Date Sun, 13 Jul 2003 18:33:28 GMT
coliver     2003/07/13 11:33:28

  Modified:    src/documentation/xdocs/userdocs/flow api.xml book.xml
                        continuations.xml how-does-it-work.xml index.xml
                        jpath.xml jxtemplate.xml sitemap.xml using.xml
                        velocity.xml views.xml
  Log:
  More FOM docs
  
  Revision  Changes    Path
  1.16      +743 -464  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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- api.xml	13 Jul 2003 01:39:54 -0000	1.15
  +++ api.xml	13 Jul 2003 18:33:27 -0000	1.16
  @@ -1,464 +1,743 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -      <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="JavaScript API">
  -	  <p>Cocoon provides a JavaScript API to manage control flow based on an
  -        <link href="http://cvs.cocoondev.org/cgi-bin/viewcvs.cgi/?cvsroot=rhino">extended</link>
  -        version of <link href="http://www.mozilla.org/rhino">Mozilla Rhino</link> that supports continuations.</p>
  -    </s1>
  -    <s1 title="Calling Java from JavaScript">
  -    <p>
  -    You can easily call any Java code from your Flowscripts, for example:
  -    </p>
  -    <source>
  -    var map = new java.util.HashMap();
  -    map.put("foo", "bar");
  -    </source>
  -
  -    <p>Classes in packages under <code>java</code> are accessible directly in your scripts.</p>
  -    <p>Note that classes under <code>java.lang</code> are not automatically imported, however:</p>
  -
  -    <p><source>var n = new java.lang.Integer(3);</source></p>
  -
  -    <p>All other java packages and classes are accessible under the property <code>Packages</code>:</p>
  -
  -    <p><source>var tree = new Packages.javax.swing.JTree();</source></p>
  -
  -    <p>You can get the effect of Java imports using the <code>importPackage()</code> and <code>importClass()</code> functions:</p>
  -    <table>
  -     <tr>
  -       <td>
  -       In Java:
  -       </td>
  -       <td>
  -       In JavaScript:
  -       </td>
  -     </tr>
  -     <tr>
  -       <td>
  -       import foo.*;
  -       </td>
  -       <td>
  -       importPackage(Packages.foo);
  -       </td>
  -     </tr>
  -     <tr>
  -       <td>
  -       import foo.Bar;
  -       </td>
  -       <td>
  -       importClass(Packages.foo.Bar);
  -       </td>
  -     </tr>
  -    </table>
  -    <p>
  -      If your Java classes have getters and setters you can access them as properties in JavaScript:</p>
  -    <p>
  -      <source>
  -              var d = new java.util.Date();
  -              d.year = 2003;    // same effect as d.setYear(2003);
  -      </source>
  -     </p>
  -    </s1>
  -    <s1 title="Flow Object Model">
  -      <p>Cocoon provides a set of system objects for use by Flowscripts. We call this set of objects the <em>Flow Object Model</em>.
  -      The Flow Object Model contains following objects:
  -    <ul>
  -      <li><link href="#cocoon">Cocoon</link></li>
  -      <li><link href="#request">Request</link></li>
  -      <li><link href="#response">Response</link></li>
  -      <li><link href="#session">Session</link></li>
  -      <li><link href="#context">Context</link></li>
  -      <li><link href="#cookie">Cookie</link></li>
  -      <li><link href="#log">Log</link></li>
  -      <li><link href="#continuation">WebContinuation</link></li>
  -    </ul>
  -    </p>
  -    <s2 title = "Cocoon Object"><anchor id="cocoon"/>
  -    <p>The <code>cocoon</code> object represents the current Cocoon sitemap and provides the following properties and functions:</p> 
  -    <s3 title="request">
  -    <p>The current Cocoon request:</p>
  -    <p>
  -    <em>Property</em> <code>[<link href="#request">Request</link>] request</code>
  -    </p>
  -    </s3>
  -    <s3 title="response">
  -    <p>The current Cocoon response:</p>
  -    <p>
  -    <em>Property</em> <code>[<link href="#response">Response</link>] response</code>
  -    </p>
  -    </s3>
  -    <s3 title="session">
  -    <p>The current Cocoon session:</p>
  -    <p>
  -    <em>Property</em> <code>[<link href="#session">Session</link>] session</code>
  -    </p>
  -    </s3>
  -    <s3 title="context">
  -    <p>The current Cocoon application context:</p>
  -    <p>
  -    <em>Property</em> <code>[<link href="#context">Context</link>] context</code>
  -    </p>
  -    </s3>
  -    <s3 title="log">
  -    <p>A reference to the current logger:</p>
  -    <p>
  -    <em>Property</em> <code>[<link href="#log">Log</link>] log</code>
  -    </p>
  -    </s3>
  -
  -    <s3 title="parameters">
  -    <p>Any parameters passed to the script by the Cocoon Sitemap</p>
  -    <p>
  -    <em>Property</em> <code>[Object] parameters</code>
  -    </p>
  -    </s3>
  -    <s3 title = "sendPage"><anchor id="sendPage"/>
  -      <p>
  -      <em>Function</em> <code>sendPage([String] uri, [Object] bean)</code>
  -      </p>
  -      <p>
  -      Passes control to the Cocoon sitemap to generate the output page.
  -      </p>
  -      <p>
  -      <code>uri</code> is the relative URL of the page to be sent back to the client.
  -      </p>
  -      <p>
  -       <code>bean</code> is a context object which can be accessed inside this page to extract
  -       various values and place them in the generated page.
  -      </p>
  -    </s3>
  -    <s3 title = "sendPageAndWait"><anchor id="sendPageAndWait"/>
  -    <p>
  -    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String] uri, [Object] bean, [Number] timeToLive)</code>
  -    </p>
  -     <p>
  -     Passes control to the Cocoon sitemap to generate the output page.
  -     </p>
  -     <p>The flow script is suspended after the page is generated and the whole execution stack
  -        saved in the WebContinuation object returned from this function. </p>
  -     <p><code>uri</code> is the relative URL of the page to be sent back to the client.
  -        <code>bean</code> is a context object which can be accessed inside this page to extract
  -        various values and place them in the generated page.</p>
  -     <p><code>timeToLive</code> is the time to live in milliseconds for the continuation created.</p>
  -     <p>The return value is the <link href="#WebContinuation">continuation</link> object.</p>
  -    </s3>
  -    <s3 title="processPipelineTo">
  -    <p>
  -    <em>Function</em> <code>processPipelineTo([String] uri, [Object] bizData, [java.io.OutputStream] stream)</code></p>
  -    <p>
  -     Call the Cocoon sitemap for the given URI, sending the output of the
  -     eventually matched pipeline to the specified <code>OutputStream</code>.</p>
  -    <p><code>uri</code> is the URI for which the request should be generated.</p>
  -    <p><code>bizData</code> is the business data object
  -     to be made available to the forwarded pipeline</p>
  -     <p><code>stream</code> is an <code>OutputStream</code> where the output should be written to.</p>
  -    </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>
  -    </s3>
  -    </s2>
  -    <s2 title="Request Object"><anchor id="request"/>
  -     
  -    <p>The <code>Request</code> object represents the current Cocoon request. It provides the following functions and properties:</p>
  -
  -    <s3 title="get">
  -    <p><em>Function</em> <code>[String] get([String] name)</code></p>
  -    <p>
  -      Get the request parameter or attribute with the specified <code>name</code>. 
  -    </p>
  -    </s3>
  -    <s3 title="getAttribute">
  -    <p><em>Function</em> <code>[String] getAttribute([String] name)</code></p>
  -    <p>
  -      Get the request attribute with the specified <code>name</code>. 
  -    </p>
  -    </s3>
  -    <s3 title="getAttributeNames">
  -    <p><em>Function</em> <code>[java.util.Enumeration] getAttributeNames()</code></p>
  -    <p>
  -      Get an enumeration of request attribute names. 
  -    </p>
  -    </s3>
  -    <s3 title="setAttribute">
  -    <p><em>Function</em> <code>setAttribute([String] name, [Object] value)</code></p>
  -    <p>
  -      Set the value of a request attribute. 
  -    </p>
  -    </s3>
  -    <s3 title="removeAttribute">
  -    <p><em>Function</em> <code>removeAttribute([String] name)</code></p>
  -    <p>
  -      Remove the attribute with the name <code>name</code> from this request. 
  -    </p>
  -    </s3>
  -
  -    <s3 title="getCharacterEncoding">
  -    <p><em>Function</em> <code>[String]getCharacterEncoding()</code></p>
  -    <p>
  -      Return the character encoding used by this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="setCharacterEncoding">
  -    <p><em>Function</em> <code>setCharacterEncoding([String] value)</code></p>
  -    <p>
  -      Set the character encoding used by this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getContentLength">
  -    <p><em>Function</em> <code>[Number] getContentLength()</code></p>
  -    <p>
  -      Get the content-length of this request
  -    </p>
  -    </s3>
  -
  -    <s3 title="getContentType">
  -    <p><em>Function</em> <code>[String] getContentType()</code></p>
  -    <p>
  -      Get the content-type of this request
  -    </p>
  -    </s3>
  -
  -    <s3 title="getParameter">
  -    <p><em>Function</em> <code>[String] getParameter([String] name)</code></p>
  -    <p>
  -      Get the request parameter with the specified <code>name</code>. 
  -    </p>
  -    </s3>
  -
  -    <s3 title="getParameterValues">
  -    <p><em>Function</em> <code>[Array] getParameterValues([String] name)</code></p>
  -    <p>
  -      Get an array of request parameters with the specified <code>name</code>. 
  -    </p>
  -    </s3>
  -
  -    <s3 title="getParameterNames">
  -    <p><em>Function</em> <code>[java.util.Enumeration] getParameterNames()</code></p>
  -    <p>
  -      Get an enumeration of the parameter names in this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getAuthType">
  -    <p><em>Function</em> <code>[String] getAuthType()</code></p>
  -    <p>
  -      Get the authorization type used in this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getProtocol">
  -    <p><em>Function</em> <code>[String] getProtocol()</code></p>
  -    <p>
  -      Get the protocol used in this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getScheme">
  -    <p><em>Function</em> <code>[String] getScheme()</code></p>
  -    <p>
  -      Get the scheme used in this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getMethod">
  -    <p><em>Function</em> <code>[String] getMethod()</code></p>
  -    <p>
  -      Get the method used in this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getServerName">
  -    <p><em>Function</em> <code>[String] getServerName()</code></p>
  -    <p>
  -      Get the server name of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getServerPort">
  -    <p><em>Function</em> <code>[Number] getServerPort()</code></p>
  -    <p>
  -      Get the server port of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getRemoteAddr">
  -    <p><em>Function</em> <code>[String] getRemoteAddr()</code></p>
  -    <p>
  -      Get the remote address of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="isSecure">
  -    <p><em>Function</em> <code>[Boolean] isSecure()</code></p>
  -    <p>
  -      Get the <code>secure</code> property of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getLocale">
  -    <p><em>Function</em> <code>[String] getLocale()</code></p>
  -    <p>
  -      Get the locale of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getLocales">
  -    <p><em>Function</em> <code>[Array [String]] getLocales()</code></p>
  -    <p>
  -      Get the locales of this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getCookies">
  -    <p><em>Function</em> <code>[Array [Cookie]] getCookies()</code></p>
  -    <p>
  -      Get the cookies associated with this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getHeader">
  -    <p><em>Function</em> <code>[String] getHeader([String] name)</code></p>
  -    <p>
  -      Get the header with <code>name</code> from this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getHeaders">
  -    <p><em>Function</em> <code>[Array] getHeaders()</code></p>
  -    <p>
  -      Get the headers associated with this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getHeaderNames">
  -    <p><em>Function</em> <code>[java.util.Enumeration] getHeaderNames()</code></p>
  -    <p>
  -      Get an enumeration of header names from this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getRemoteUser">
  -    <p><em>Function</em> <code>[String] getRemoteUser()</code></p>
  -    <p>
  -      Get the remote user associated with this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getUserPrincipal">
  -    <p><em>Function</em> <code>[String] getUserPrincipal()</code></p>
  -    <p>
  -      Get the user principal associated with this request.
  -    </p>
  -    </s3>
  -
  -    <s3 title="getUserPrincipal">
  -    <p><em>Function</em> <code>[Boolean] isUserInRole([String] role)</code></p>
  -    <p>
  -      Returns whether the user associated with this request is in the specified <code>role</code>.
  -    </p>
  -    </s3>
  -    <s3 title="Properties">
  -    <p>
  -    
  -    [name] -> maps to the parameter with that name. For example <code>request.blah</code> is equivalent to <code>request.getParameter("blah")</code>
  -    </p> 
  -    </s3>
  -    </s2>
  -    <s2 title="Log Object"><anchor id="log"/>
  -    <p> The <code>log</code> object provides an interface to the Cocoon logging system.
  -    </p>
  -    <p>
  -        It supports the following functions:
  -    </p>
  -    <s3 title="error">
  -    <p>
  -        <em>Function</em> <code>error([String] message)</code>
  -    </p>
  -    <p>
  -      Log an error message.
  -    </p>
  -    </s3>
  -    <s3 title="debug">
  -    <p>
  -        <em>Function</em> <code>debug([String] message)</code>
  -    </p>
  -    <p>
  -      Log a debug message.
  -    </p>
  -    </s3>
  -    <s3 title="warn">
  -    <p>
  -        <em>Function</em> <code>warn([String] message)</code>
  -    </p>
  -    <p>
  -      Log a warning message.
  -    </p>
  -    </s3>
  -    <s3 title="info">
  -    <p>
  -        <em>Function</em> <code>info([String] message)</code>
  -    </p>
  -    <p>
  -      Log an information message.
  -    </p>
  -    </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.
  -    </p>
  -    <p>
  -       If there is no parent <code>WebContinuation</code>, the created continuation becomes the root of a tree of <code>WebContinuation</code>s.
  -    </p>
  -    <p>
  -       <code>WebContinuation</code> objects support the following functions and properties:
  -    </p>
  -    <s3 title="getContinuation">
  -    <p>
  -        <em>Function</em> <code>[WebContinuation] getContinuation([Number] level)</code>
  -    </p>
  -    <p>
  -      Return the ancestor continuation situated <code>level</code>s
  -      above the current continuation. The current instance is
  -      considered to be at level 0. The parent continuation of the
  -      receiving instance at level 1, its parent is at level 2 relative
  -      to the receiving instance. If <code>level</code> is bigger than
  -      the depth of the tree, the root of the tree is returned.
  -    </p>
  -    </s3>
  -    <s3 title="invalidate">
  -    <p>
  -        <em>Function</em> <code>invalidate()</code>
  -    </p>
  -    <p>
  -      Invalidates a <code>WebContinuation</code>. This effectively
  -      means that the continuation object associated with it will no
  -      longer be accessible from Web pages. Invalidating a
  -      <code>WebContinuation</code> invalidates all the
  -      <code>WebContinuation</code>s which are children of it.    
  -    </p>
  -    </s3>
  -    <s3 title="id">
  -    <p><em>Property</em> <code>[String] id</code></p>
  -    <p>Returns the unique string identifier of this continuation</p>
  -    </s3>
  -    </s2>
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +      <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="JavaScript API">
  +	  <p>Cocoon provides a JavaScript API to manage control flow based on an
  +        <link href="http://cvs.cocoondev.org/cgi-bin/viewcvs.cgi/?cvsroot=rhino">extended</link>
  +        version of <link href="http://www.mozilla.org/rhino">Mozilla Rhino</link> that supports continuations.</p>
  +    </s1>
  +    <s1 title="Calling Java from JavaScript">
  +    <p>
  +    You can easily call any Java code from your Flowscripts, for example:
  +    </p>
  +    <source>
  +    var map = new java.util.HashMap();
  +    map.put("foo", "bar");
  +    </source>
  +
  +    <p>Classes in packages under <code>java</code> are accessible directly in your scripts.</p>
  +    <p>Note that classes under <code>java.lang</code> are not automatically imported, however:</p>
  +
  +    <p><source>var n = new java.lang.Integer(3);</source></p>
  +
  +    <p>All other java packages and classes are accessible under the property <code>Packages</code>:</p>
  +
  +    <p><source>var tree = new Packages.javax.swing.JTree();</source></p>
  +
  +    <p>You can get the effect of Java imports using the <code>importPackage()</code> and <code>importClass()</code> functions:</p>
  +    <table>
  +     <tr>
  +       <td>
  +       In Java:
  +       </td>
  +       <td>
  +       In JavaScript:
  +       </td>
  +     </tr>
  +     <tr>
  +       <td>
  +       import foo.*;
  +       </td>
  +       <td>
  +       importPackage(Packages.foo);
  +       </td>
  +     </tr>
  +     <tr>
  +       <td>
  +       import foo.Bar;
  +       </td>
  +       <td>
  +       importClass(Packages.foo.Bar);
  +       </td>
  +     </tr>
  +    </table>
  +    <p>
  +      If your Java classes have getters and setters you can access them as properties in JavaScript:</p>
  +    <p>
  +      <source>
  +              var d = new java.util.Date();
  +              d.year = 2003;    // same effect as d.setYear(2003);
  +      </source>
  +     </p>
  +    </s1>
  +    <s1 title="Flow Object Model">
  +      <p>Cocoon provides a set of system objects for use by Flowscripts. We call this set of objects the Flow Object Model (<em>FOM</em>).
  +      The Flow Object Model contains following objects:
  +    <ul>
  +      <li><link href="#cocoon">Cocoon</link></li>
  +      <li><link href="#request">Request</link></li>
  +      <li><link href="#response">Response</link></li>
  +      <li><link href="#session">Session</link></li>
  +      <li><link href="#context">Context</link></li>
  +      <li><link href="#cookie">Cookie</link></li>
  +      <li><link href="#log">Log</link></li>
  +      <li><link href="#WebContinuation">WebContinuation</link></li>
  +    </ul>
  +    </p>
  +    <s2 title = "Cocoon Object"><anchor id="cocoon"/>
  +    <p>The <code>Cocoon</code> object represents the current Cocoon Sitemap. This is the entry point into the FOM. There is one instance of <code>Cocoon</code> which you may access in your scripts as the global variable <code>cocoon</code>, for example like this:</p>
  +    <source>
  +         var value = cocoon.request.getAttribute("blah");
  +    </source>
  +    <p>
  +     The <code>Cocoon</code> object supports the following properties and functions:
  +    </p>
  +    <s3 title="request">
  +    <p>The current Cocoon request:</p>
  +    <p>
  +    <em>Property</em> <code>[<link href="#request">Request</link>] request</code>
  +    </p>
  +    </s3>
  +    <s3 title="response">
  +    <p>The current Cocoon response:</p>
  +    <p>
  +    <em>Property</em> <code>[<link href="#response">Response</link>] response</code>
  +    </p>
  +    </s3>
  +    <s3 title="session">
  +    <p>The current Cocoon session:</p>
  +    <p>
  +    <em>Property</em> <code>[<link href="#session">Session</link>] session</code>
  +    </p>
  +    </s3>
  +    <s3 title="context">
  +    <p>The current Cocoon application context:</p>
  +    <p>
  +    <em>Property</em> <code>[<link href="#context">Context</link>] context</code>
  +    </p>
  +    </s3>
  +    <s3 title="log">
  +    <p>A reference to the current logger:</p>
  +    <p>
  +    <em>Property</em> <code>[<link href="#log">Log</link>] log</code>
  +    </p>
  +    </s3>
  +
  +    <s3 title="parameters">
  +    <p>Any parameters passed to the script by the Cocoon Sitemap</p>
  +    <p>
  +    <em>Property</em> <code>[Object] parameters</code>
  +    </p>
  +    </s3>
  +    <s3 title = "sendPage"><anchor id="sendPage"/>
  +      <p>
  +      <em>Function</em> <code>sendPage([String] uri, [Object] bean)</code>
  +      </p>
  +      <p>
  +      Passes control to the Cocoon sitemap to generate the output page.
  +      </p>
  +      <p>
  +      <code>uri</code> is the relative URL of the page to be sent back to the client.
  +      </p>
  +      <p>
  +       <code>bean</code> is a context object which can be accessed inside this page to extract
  +       various values and place them in the generated page.
  +      </p>
  +    </s3>
  +    <s3 title = "sendPageAndWait"><anchor id="sendPageAndWait"/>
  +    <p>
  +    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String] uri, [Object] bean, [Number] timeToLive)</code>
  +    </p>
  +     <p>
  +     Passes control to the Cocoon sitemap to generate the output page.
  +     </p>
  +     <p>The flow script is suspended after the page is generated and the whole execution stack
  +        saved in the WebContinuation object returned from this function. </p>
  +     <p><code>uri</code> is the relative URL of the page to be sent back to the client.
  +        <code>bean</code> is a context object which can be accessed inside this page to extract
  +        various values and place them in the generated page.</p>
  +     <p><code>timeToLive</code> is the time to live in milliseconds for the continuation created.</p>
  +     <p>The return value is the <link href="#WebContinuation">continuation</link> object.</p>
  +    </s3>
  +    <s3 title="processPipelineTo">
  +    <p>
  +    <em>Function</em> <code>processPipelineTo([String] uri, [Object] bizData, [java.io.OutputStream] stream)</code></p>
  +    <p>
  +     Call the Cocoon sitemap for the given URI, sending the output of the
  +     eventually matched pipeline to the specified <code>OutputStream</code>.</p>
  +    <p><code>uri</code> is the URI for which the request should be generated.</p>
  +    <p><code>bizData</code> is the business data object
  +     to be made available to the forwarded pipeline</p>
  +     <p><code>stream</code> is an <code>OutputStream</code> where the output should be written to.</p>
  +    </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>
  +    </s3>
  +    </s2>
  +    <s2 title="Request Object"><anchor id="request"/>
  +     
  +    <p>The <code>Request</code> object represents the current Cocoon request. It provides the following functions and properties:</p>
  +
  +    <s3 title="get">
  +    <p><em>Function</em> <code>[String] get([String] name)</code></p>
  +    <p>
  +      Get the request parameter or attribute with the specified <code>name</code>. 
  +    </p>
  +    </s3>
  +    <s3 title="getAttribute">
  +    <p><em>Function</em> <code>[String] getAttribute([String] name)</code></p>
  +    <p>
  +      Get the request attribute with the specified <code>name</code>. 
  +    </p>
  +    </s3>
  +    <s3 title="getAttributeNames">
  +    <p><em>Function</em> <code>[java.util.Enumeration] getAttributeNames()</code></p>
  +    <p>
  +      Get an enumeration of request attribute names. 
  +    </p>
  +    </s3>
  +    <s3 title="setAttribute">
  +    <p><em>Function</em> <code>setAttribute([String] name, [Object] value)</code></p>
  +    <p>
  +      Set the value of a request attribute. 
  +    </p>
  +    </s3>
  +    <s3 title="removeAttribute">
  +    <p><em>Function</em> <code>removeAttribute([String] name)</code></p>
  +    <p>
  +      Remove the attribute with the name <code>name</code> from this request. 
  +    </p>
  +    </s3>
  +
  +    <s3 title="getCharacterEncoding">
  +    <p><em>Function</em> <code>[String]getCharacterEncoding()</code></p>
  +    <p>
  +      Return the character encoding used by this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="setCharacterEncoding">
  +    <p><em>Function</em> <code>setCharacterEncoding([String] value)</code></p>
  +    <p>
  +      Set the character encoding used by this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getContentLength">
  +    <p><em>Function</em> <code>[Number] getContentLength()</code></p>
  +    <p>
  +      Get the content-length of this request
  +    </p>
  +    </s3>
  +
  +    <s3 title="getContentType">
  +    <p><em>Function</em> <code>[String] getContentType()</code></p>
  +    <p>
  +      Get the content-type of this request
  +    </p>
  +    </s3>
  +
  +    <s3 title="getParameter">
  +    <p><em>Function</em> <code>[String] getParameter([String] name)</code></p>
  +    <p>
  +      Get the request parameter with the specified <code>name</code>. 
  +    </p>
  +    </s3>
  +
  +    <s3 title="getParameterValues">
  +    <p><em>Function</em> <code>[Array] getParameterValues([String] name)</code></p>
  +    <p>
  +      Get an array of request parameters with the specified <code>name</code>. 
  +    </p>
  +    </s3>
  +
  +    <s3 title="getParameterNames">
  +    <p><em>Function</em> <code>[java.util.Enumeration] getParameterNames()</code></p>
  +    <p>
  +      Get an enumeration of the parameter names in this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getAuthType">
  +    <p><em>Function</em> <code>[String] getAuthType()</code></p>
  +    <p>
  +      Get the authorization type used in this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getProtocol">
  +    <p><em>Function</em> <code>[String] getProtocol()</code></p>
  +    <p>
  +      Get the protocol used in this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getScheme">
  +    <p><em>Function</em> <code>[String] getScheme()</code></p>
  +    <p>
  +      Get the scheme used in this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getMethod">
  +    <p><em>Function</em> <code>[String] getMethod()</code></p>
  +    <p>
  +      Get the method used in this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getServerName">
  +    <p><em>Function</em> <code>[String] getServerName()</code></p>
  +    <p>
  +      Get the server name of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getServerPort">
  +    <p><em>Function</em> <code>[Number] getServerPort()</code></p>
  +    <p>
  +      Get the server port of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getRemoteAddr">
  +    <p><em>Function</em> <code>[String] getRemoteAddr()</code></p>
  +    <p>
  +      Get the remote address of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="isSecure">
  +    <p><em>Function</em> <code>[Boolean] isSecure()</code></p>
  +    <p>
  +      Get the <code>secure</code> property of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getLocale">
  +    <p><em>Function</em> <code>[String] getLocale()</code></p>
  +    <p>
  +      Get the locale of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getLocales">
  +    <p><em>Function</em> <code>[Array [String]] getLocales()</code></p>
  +    <p>
  +      Get the locales of this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getCookies">
  +    <p><em>Function</em> <code>[Array [Cookie]] getCookies()</code></p>
  +    <p>
  +      Get the cookies associated with this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getHeader">
  +    <p><em>Function</em> <code>[String] getHeader([String] name)</code></p>
  +    <p>
  +      Get the header with <code>name</code> from this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getHeaders">
  +    <p><em>Function</em> <code>[Array] getHeaders()</code></p>
  +    <p>
  +      Get the headers associated with this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getHeaderNames">
  +    <p><em>Function</em> <code>[java.util.Enumeration] getHeaderNames()</code></p>
  +    <p>
  +      Get an enumeration of header names from this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getRemoteUser">
  +    <p><em>Function</em> <code>[String] getRemoteUser()</code></p>
  +    <p>
  +      Get the remote user associated with this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="getUserPrincipal">
  +    <p><em>Function</em> <code>[String] getUserPrincipal()</code></p>
  +    <p>
  +      Get the user principal associated with this request.
  +    </p>
  +    </s3>
  +
  +    <s3 title="isUserInRole">
  +    <p><em>Function</em> <code>[Boolean] isUserInRole([String] role)</code></p>
  +    <p>
  +      Returns whether the user associated with this request is in the specified <code>role</code>.
  +    </p>
  +    </s3>
  +    <s3 title="Properties">
  +    <p>
  +    
  +    [name] -> maps to the parameter with that name. For example <code>request.blah</code> is equivalent to <code>request.getParameter("blah")</code>
  +    </p> 
  +    </s3>
  +    </s2>
  +    <s2 title="Response Object"><anchor id="response"/>
  +    <p>The <code>Response</code> object represents the Cocoon response associated with the current request.</p>
  +     <p>
  +     The response object contains hooks only to the cookies and to the response headers. Everything else will be controlled by the rest of the cocoon pipeline machinery (like output encoding, for example, which should *NOT* be determined by the flow).
  +     </p>
  +    <p>It provides the following functions and properties:</p>
  +    <s3 title="createCookie">
  +    <p><em>Function</em> <code>[Cookie] createCookie([String] name, [String] value)</code></p>
  +    <p>
  +      Creates a new <link href="#cookie">Cookie</link>. 
  +    </p>
  +    </s3>
  +    <s3 title="addCookie">
  +    <p><em>Function</em> <code>addCookie([Cookie] cookie)</code></p>
  +    <p>
  +      Adds <code>cookie</code> to the current response. 
  +    </p>
  +    </s3>
  +    <s3 title="containsHeader">
  +    <p><em>Function</em> <code>[Boolean] containsHeader([String] name)</code></p>
  +    <p>
  +      Returns whether the current response contains a header with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="setHeader">
  +    <p><em>Function</em> <code>setHeader([String] name, [String] value)</code></p>
  +    <p>
  +      Replaces the value of the header with <code>name</code> with <code>value</code>.
  +    </p>
  +    </s3>
  +    <s3 title="addHeader">
  +    <p><em>Function</em> <code>addHeader([String] name, [String] value)</code></p>
  +    <p>
  +      Creates a new header in the current response with the specified <code>name</code> and <code>value</code>.
  +    </p>
  +    </s3>
  +    </s2>
  +    <s2 title="Session Object"><anchor id="session"/>
  +    <p>The <code>Session</code> object represents the user session associated with the current Cocoon request.</p>
  +    <p>It provides the following functions and properties:</p>
  +    <s3 title="getAttribute">
  +    <p><em>Function</em> <code>[Object] getAttribute([String] name)</code></p>
  +    <p>
  +      Get the value of the session attribute with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="setAttribute">
  +    <p><em>Function</em> <code>setAttribute([String] name, [Object] value)</code></p>
  +    <p>
  +      Set the value of the session attribute with the specified <code>name</code> to <code>value</code>.
  +    </p>
  +    </s3>
  +    <s3 title="removeAttribute">
  +    <p><em>Function</em> <code>removeAttribute([String] name)</code></p>
  +    <p>
  +      Remove the session attribute with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="invalidate">
  +    <p><em>Function</em> <code>invalidate()</code></p>
  +    <p>
  +      Invalidate this session, releasing all resources associated with it.
  +    </p>
  +    </s3>
  +    <s3 title="isNew">
  +    <p><em>Function</em> <code>[Boolean] isNew()</code></p>
  +    <p>
  +      Returns <code>true</code> if the client does not yet know about the
  +      session or if the client chooses not to join the session.  For
  +      example, if the server used only cookie-based sessions, and
  +      the client had disabled the use of cookies, then a session would
  +      be new on each request.
  +    </p>
  +    </s3>
  +    <s3 title="getId">
  +    <p><em>Function</em> <code>[String] getId()</code></p>
  +    <p>
  +      Returns the unique id associated with this session.
  +    </p>
  +    </s3>
  +    <s3 title="getCreationTime">
  +    <p><em>Function</em> <code>[Number] getCreationTime()</code></p>
  +    <p>
  +      Returns the time when this session was created, measured
  +      in milliseconds since midnight January 1, 1970 GMT.
  +    </p>
  +    </s3>
  +    <s3 title="getLastAccessedTime">
  +    <p><em>Function</em> <code>[Number] getLastAccessedTime()</code></p>
  +    <p>
  +      Returns the last time the client sent a request associated with
  +      this session, as the number of milliseconds since midnight
  +      January 1, 1970 GMT.
  +    </p>
  +    </s3>
  +    <s3 title="setMaxInactiveInterval">
  +    <p><em>Function</em> <code>setMaxInactiveInterval([Number] interval)</code></p>
  +    <p>
  +      Specifies the time, in seconds, between client requests before the
  +      contextcontainer will invalidate this session.  A negative time
  +      indicates the session should never timeout.
  +    </p>
  +    </s3>
  +    <s3 title="getMaxInactiveInterval">
  +    <p><em>Function</em> <code>[Number] getMaxInactiveInterval()</code></p>
  +    <p>
  +     Returns the maximum time interval, in seconds, that
  +     the context container will keep this session open between
  +     client accesses. After this interval, the context container
  +     will invalidate the session.  The maximum time interval can be set
  +     with the <code>setMaxInactiveInterval</code> method.
  +     A negative time indicates the session should never timeout.
  +    </p>
  +    </s3>
  +    <s3 title="Properties">
  +    <p>
  +      [name] -> maps to the attribute indicates with the name</p>
  +
  +      <p>For example session.blah is equivalent to session.getAttribute("blah") 
  +    </p>
  +    </s3>
  +    </s2>
  +    <s2 title="Context Object"><anchor id="context"/>
  +    <p>The <code>Context</code> object represents the client context associated with the current Cocoon request.</p>
  +    <p>It provides the following functions and properties:</p>
  +    <s3 title="getAttribute">
  +    <p><em>Function</em> <code>[Object] getAttribute([String] name)</code></p>
  +    <p>
  +      Get the value of the context attribute with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="setAttribute">
  +    <p><em>Function</em> <code>setAttribute([String] name, [Object] value)</code></p>
  +    <p>
  +      Set the value of the context attribute with the specified <code>name</code> to <code>value</code>.
  +    </p>
  +    </s3>
  +    <s3 title="removeAttribute">
  +    <p><em>Function</em> <code>removeAttribute([String] name)</code></p>
  +    <p>
  +      Remove the context attribute with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="getInitParameter">
  +    <p><em>Function</em> <code>getInitParameter([String] name)</code></p>
  +    <p>
  +      Get the value of the context initialization parameter with the specified <code>name</code>.
  +    </p>
  +    </s3>
  +    <s3 title="Properties">
  +    <p>
  +      [name] -> maps to the attribute indicates with the name</p>
  +
  +      <p>For example context.blah is equivalent to context.getAttribute("blah") 
  +    </p>
  +    </s3>
  +    </s2>
  +    <s2 title="Cookie Object"><anchor id="cookie"/>
  +    <p><code>Cookie</code> provides the following functions and properties:</p>
  +    <s3 title="getName">
  +    <p><em>Function</em> <code>[String] getName()</code></p>
  +    <p>
  +       Get the name of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getVersion">
  +    <p><em>Function</em> <code>[String] getVersion()</code></p>
  +    <p>
  +       Get the version of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setVersion">
  +    <p><em>Function</em> <code>setVersion([String] version)</code></p>
  +    <p>
  +       Set the version of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getValue">
  +    <p><em>Function</em> <code>[String] getValue()</code></p>
  +    <p>
  +       Get the value of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setValue">
  +    <p><em>Function</em> <code>setValue([String] value)</code></p>
  +    <p>
  +       Set the value of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getComment">
  +    <p><em>Function</em> <code>[String] getComment()</code></p>
  +    <p>
  +       Get the comment of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setComment">
  +    <p><em>Function</em> <code>setComment([String] comment)</code></p>
  +    <p>
  +       Set the comment of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getDomain">
  +    <p><em>Function</em> <code>[String] getDomain()</code></p>
  +    <p>
  +       Get the domain of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setDomain">
  +    <p><em>Function</em> <code>setDomain([String] domain)</code></p>
  +    <p>
  +       Set the domain of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getPath">
  +    <p><em>Function</em> <code>[String] getPath()</code></p>
  +    <p>
  +       Get the path of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setPath">
  +    <p><em>Function</em> <code>setPath([String] path)</code></p>
  +    <p>
  +       Set the path of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="getSecure">
  +    <p><em>Function</em> <code>[Boolean] getSecure()</code></p>
  +    <p>
  +       Get the secure property of this cookie.
  +    </p>
  +    </s3>
  +    <s3 title="setSecure">
  +    <p><em>Function</em> <code>setSecure([Boolean] value)</code></p>
  +    <p>
  +       Set the secure property of this cookie.
  +    </p>
  +    </s3>
  +    </s2>
  +    <s2 title="Log Object"><anchor id="log"/>
  +    <p> The <code>log</code> object provides an interface to the Cocoon logging system.
  +    </p>
  +    <p>
  +        It supports the following functions:
  +    </p>
  +    <s3 title="error">
  +    <p>
  +        <em>Function</em> <code>error([String] message)</code>
  +    </p>
  +    <p>
  +      Log an error message.
  +    </p>
  +    </s3>
  +    <s3 title="debug">
  +    <p>
  +        <em>Function</em> <code>debug([String] message)</code>
  +    </p>
  +    <p>
  +      Log a debug message.
  +    </p>
  +    </s3>
  +    <s3 title="warn">
  +    <p>
  +        <em>Function</em> <code>warn([String] message)</code>
  +    </p>
  +    <p>
  +      Log a warning message.
  +    </p>
  +    </s3>
  +    <s3 title="info">
  +    <p>
  +        <em>Function</em> <code>info([String] message)</code>
  +    </p>
  +    <p>
  +      Log an information message.
  +    </p>
  +    </s3>
  +    <s3 title="isErrorEnabled">
  +    <p>
  +        <em>Function</em> <code>[Boolean] isErrorEnabled()</code>
  +    </p>
  +    <p>
  +      Returns whether error message logging is enabled.
  +    </p>
  +    </s3>
  +    <s3 title="isDebugEnabled">
  +    <p>
  +        <em>Function</em> <code>[Boolean] isDebugEnabled()</code>
  +    </p>
  +    <p>
  +      Returns whether debug message logging is enabled.
  +    </p>
  +    </s3>
  +    <s3 title="isWarnEnabled">
  +    <p>
  +        <em>Function</em> <code>[Boolean] isWarnEnabled()</code>
  +    </p>
  +    <p>
  +      Returns whether warning message logging is enabled.
  +    </p>
  +    </s3>
  +    <s3 title="isInfoEnabled">
  +    <p>
  +        <em>Function</em> <code>[Boolean] isInfoEnabled()</code>
  +    </p>
  +    <p>
  +      Returns whether information message logging is enabled
  +    </p>
  +    </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.
  +    </p>
  +    <p>
  +       If there is no parent <code>WebContinuation</code>, the created continuation becomes the root of a tree of <code>WebContinuation</code>s.
  +    </p>
  +    <p>
  +       <code>WebContinuation</code> objects support the following functions and properties:
  +    </p>
  +    <s3 title="getParent">
  +    <p>
  +        <em>Function</em> <code>[WebContinuation] getParent()</code>
  +    </p>
  +    <p>
  +     Get the parent continuation of this continuation.
  +    </p>
  +    </s3>
  +    <s3 title="getChildren">
  +    <p>
  +        <em>Function</em> <code>[Array [WebContinuation]] getChildren()</code>
  +    </p>
  +    <p>
  +     Get the child continuations of this continuation.
  +    </p>
  +    </s3>
  +    <s3 title="invalidate">
  +    <p>
  +        <em>Function</em> <code>invalidate()</code>
  +    </p>
  +    <p>
  +      Invalidates a <code>WebContinuation</code>. This effectively
  +      means that the continuation object associated with it will no
  +      longer be accessible from Web pages. Invalidating a
  +      <code>WebContinuation</code> invalidates all the
  +      <code>WebContinuation</code>s which are children of it.    
  +    </p>
  +    </s3>
  +    <s3 title="id">
  +    <p><em>Property</em> <code>[String] id</code></p>
  +    <p>Returns the unique string identifier of this continuation</p>
  +    </s3>
  +    </s2>
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.8       +27 -27    cocoon-2.1/src/documentation/xdocs/userdocs/flow/book.xml
  
  Index: book.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/book.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- book.xml	13 Jul 2003 01:39:54 -0000	1.7
  +++ book.xml	13 Jul 2003 18:33:27 -0000	1.8
  @@ -1,27 +1,27 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../../dtd/book-cocoon-v10.dtd">
  -
  -<book software="Apache Cocoon" 
  -      title="Apache Schecoon Documentation" 
  -      copyright="1999-2003 The Apache Software Foundation">
  -
  -  <menu label="Navigation">
  -    <menu-item label="Main" href="../../index.html"/>
  -    <menu-item label="User Documentation" href="../index.html"/>
  -  </menu>
  -  
  -  <menu label="Flowscript">
  -    <menu-item label="Introduction" href="index.html"/>
  -    <menu-item label="Continuations" href="continuations.html"/>
  -    <menu-item label="How does it work?" href="how-does-it-work.html"/>
  -    <menu-item label="Usage" href="using.html"/>
  -    <menu-item label="Sitemap" href="sitemap.html"/>
  -    <menu-item label="JavaScript API" href="api.html"/>
  -    <menu-item label="Views" href="views.html"/>
  -    <menu-item label="JXTemplate" href="jxtemplate.html"/>
  -    <menu-item label="JPath" href="jpath.html"/>
  -    <menu-item label="Velocity" href="velocity.html"/> 
  -    <menu-item label="JXForms" href="jxforms.html"/>
  -    <menu-item label="Woody" href="woody.html"/>
  -  </menu>
  -</book>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../../dtd/book-cocoon-v10.dtd">
  +
  +<book software="Apache Cocoon" 
  +      title="Apache Schecoon Documentation" 
  +      copyright="1999-2003 The Apache Software Foundation">
  +
  +  <menu label="Navigation">
  +    <menu-item label="Main" href="../../index.html"/>
  +    <menu-item label="User Documentation" href="../index.html"/>
  +  </menu>
  +  
  +  <menu label="Flowscript">
  +    <menu-item label="Introduction" href="index.html"/>
  +    <menu-item label="Continuations" href="continuations.html"/>
  +    <menu-item label="How does it work?" href="how-does-it-work.html"/>
  +    <menu-item label="Usage" href="using.html"/>
  +    <menu-item label="Sitemap" href="sitemap.html"/>
  +    <menu-item label="JavaScript API" href="api.html"/>
  +    <menu-item label="Views" href="views.html"/>
  +    <menu-item label="JXTemplate" href="jxtemplate.html"/>
  +    <menu-item label="JPath" href="jpath.html"/>
  +    <menu-item label="Velocity" href="velocity.html"/> 
  +    <menu-item label="JXForms" href="jxforms.html"/>
  +    <menu-item label="Woody" href="woody.html"/>
  +  </menu>
  +</book>
  
  
  
  1.8       +115 -115  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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- continuations.xml	13 Jul 2003 01:39:54 -0000	1.7
  +++ continuations.xml	13 Jul 2003 18:33:27 -0000	1.8
  @@ -1,115 +1,115 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="A different approach">
  -      <p>Web applications are essentially event-driven
  -      applications. Such applications have to react to events
  -      generated from the client browser, and they respond to these
  -      perhaps by changing their internal state and generating a
  -      response.</p>
  -
  -      <p>The result is that even a simple application that needs to
  -      collect some information from the user using more than one page,
  -      has to somehow maintain the input accumulated so far from the
  -      user. This input is a characteristic of the application
  -      state. Another characteristic of the application state is where
  -      the program processing is.</p>
  -
  -      <p>Let's look at an example. Suppose we want to write a very
  -      simple calculator, which collects the numbers to be added, as
  -      well as the operator, each in a separate page. It would be very
  -      nice if we could write something like this:</p>
  -
  -      <source><![CDATA[
  -function calculator()
  -{
  -  var a, b, operator;
  -
  -  cocoon.sendPageAndWait("getA.html");
  -  a = cocoon.request.get("a");
  -
  -  cocoon.sendPageAndWait("getB.html");
  -  b = cocoon.request.get("b");
  -
  -  cocoon.sendPageAndWait("getOperator.html");
  -  operator = cocoon.request.get("op");
  -
  -  try {
  -    if (operator == "plus")
  -      cocoon.sendPage("result.html", {result: a + b});
  -    else if (operator == "minus")
  -      cocoon.sendPage("result.html", {result: a - b});
  -    else if (operator == "multiply")
  -      cocoon.sendPage("result.html", {result: a * b});
  -    else if (operator == "divide")
  -      cocoon.sendPage("result.html", {result: a / b});
  -    else
  -      cocoon.sendPage("invalidOperator.html", {operator: operator});
  -  }
  -  catch (exception) {
  -    cocoon.sendPage("error.html", {message: "Operation failed: " + exception.toString()});
  -  }
  -}
  -]]></source>
  -
  -      <p>In this example, the <code>calculator</code> function is
  -      called to start the calculator application. We'd like the
  -      <code>sendPageAndWait</code> function to be a special function, that
  -      takes as arguments an HTML file to be sent as response, and some
  -      optional data that needs to be placed dynamically in it. We
  -      would like <code>sendPageAndWait</code> to send the response page and
  -      then block the executing thread, until the user clicks on a link
  -      in the response page, which sends a request back to the
  -      server. This request resumes the processing at the point it was
  -      left, right after the call to <code>sendPageAndWait</code>.</p>
  -
  -      <p>This approach looks very powerful, since the flow of pages
  -      within the application can be described as a normal
  -      program. Using this approach you no longer have to think of your
  -      Web application as a finite state machine, which transitions
  -      from one state to another, and in the process generates response
  -      pages.</p>
  -
  -      <p>A big disadvantage of the approach above is that we need to
  -      maintain a thread alive until the user hits the link on the
  -      response page. This is clearly very expensive!</p>
  -
  -      <p>It would be very nice if we could capture the state of the
  -      application, its stack of function calls, which includes local
  -      variables, the global variables and the program counter, and
  -      save them into an object. If this object would give us the
  -      ability to restart the processing from the point stored in it,
  -      this would be what we need!</p>
  -
  -      <s2 title="What are continuations?">
  -
  -	<p>A continuation is exactly the type of object that we need.
  -	Think of a continuation as an object that, for a given point
  -	in your program, contains a snapshot of the stack trace,
  -	including all the local variables, and the program
  -	counter. You can not only store these things in the
  -	continuation object, but also restore the execution of the
  -	program from a continuation object. This means that the stack
  -	trace and the program counter of the running program become
  -	the ones stored in a continuation.</p>
  -
  -	<p>Continuations are powerful concepts from the world of
  -	functional languages, like <link
  -	href="http://www.schemers.org/">Scheme</link>, but they are
  -	becoming popular in other languages as well.</p>
  -
  -    </s2>
  -
  -  </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="A different approach">
  +      <p>Web applications are essentially event-driven
  +      applications. Such applications have to react to events
  +      generated from the client browser, and they respond to these
  +      perhaps by changing their internal state and generating a
  +      response.</p>
  +
  +      <p>The result is that even a simple application that needs to
  +      collect some information from the user using more than one page,
  +      has to somehow maintain the input accumulated so far from the
  +      user. This input is a characteristic of the application
  +      state. Another characteristic of the application state is where
  +      the program processing is.</p>
  +
  +      <p>Let's look at an example. Suppose we want to write a very
  +      simple calculator, which collects the numbers to be added, as
  +      well as the operator, each in a separate page. It would be very
  +      nice if we could write something like this:</p>
  +
  +      <source><![CDATA[
  +function calculator()
  +{
  +  var a, b, operator;
  +
  +  cocoon.sendPageAndWait("getA.html");
  +  a = cocoon.request.get("a");
  +
  +  cocoon.sendPageAndWait("getB.html");
  +  b = cocoon.request.get("b");
  +
  +  cocoon.sendPageAndWait("getOperator.html");
  +  operator = cocoon.request.get("op");
  +
  +  try {
  +    if (operator == "plus")
  +      cocoon.sendPage("result.html", {result: a + b});
  +    else if (operator == "minus")
  +      cocoon.sendPage("result.html", {result: a - b});
  +    else if (operator == "multiply")
  +      cocoon.sendPage("result.html", {result: a * b});
  +    else if (operator == "divide")
  +      cocoon.sendPage("result.html", {result: a / b});
  +    else
  +      cocoon.sendPage("invalidOperator.html", {operator: operator});
  +  }
  +  catch (exception) {
  +    cocoon.sendPage("error.html", {message: "Operation failed: " + exception.toString()});
  +  }
  +}
  +]]></source>
  +
  +      <p>In this example, the <code>calculator</code> function is
  +      called to start the calculator application. We'd like the
  +      <code>sendPageAndWait</code> function to be a special function, that
  +      takes as arguments an HTML file to be sent as response, and some
  +      optional data that needs to be placed dynamically in it. We
  +      would like <code>sendPageAndWait</code> to send the response page and
  +      then block the executing thread, until the user clicks on a link
  +      in the response page, which sends a request back to the
  +      server. This request resumes the processing at the point it was
  +      left, right after the call to <code>sendPageAndWait</code>.</p>
  +
  +      <p>This approach looks very powerful, since the flow of pages
  +      within the application can be described as a normal
  +      program. Using this approach you no longer have to think of your
  +      Web application as a finite state machine, which transitions
  +      from one state to another, and in the process generates response
  +      pages.</p>
  +
  +      <p>A big disadvantage of the approach above is that we need to
  +      maintain a thread alive until the user hits the link on the
  +      response page. This is clearly very expensive!</p>
  +
  +      <p>It would be very nice if we could capture the state of the
  +      application, its stack of function calls, which includes local
  +      variables, the global variables and the program counter, and
  +      save them into an object. If this object would give us the
  +      ability to restart the processing from the point stored in it,
  +      this would be what we need!</p>
  +
  +      <s2 title="What are continuations?">
  +
  +	<p>A continuation is exactly the type of object that we need.
  +	Think of a continuation as an object that, for a given point
  +	in your program, contains a snapshot of the stack trace,
  +	including all the local variables, and the program
  +	counter. You can not only store these things in the
  +	continuation object, but also restore the execution of the
  +	program from a continuation object. This means that the stack
  +	trace and the program counter of the running program become
  +	the ones stored in a continuation.</p>
  +
  +	<p>Continuations are powerful concepts from the world of
  +	functional languages, like <link
  +	href="http://www.schemers.org/">Scheme</link>, but they are
  +	becoming popular in other languages as well.</p>
  +
  +    </s2>
  +
  +  </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.8       +41 -41    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- how-does-it-work.xml	13 Jul 2003 01:39:54 -0000	1.7
  +++ how-does-it-work.xml	13 Jul 2003 18:33:27 -0000	1.8
  @@ -1,41 +1,41 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="Cocoon and continuations">
  -	<p>With continuations in the language, you can essentially
  -	store the continuation of <code>sendPageAndWait()</code> (think of all
  -	the stack trace, and the program counter), put it in a global
  -	hash table associated with an id. The id is then encoded in
  -	the <code>response.xml</code> page as an URL. When the user
  -	clicks on that URL, on the server side the associated
  -	continuation is resumed. Resuming the processing happens as if
  -	nothing was stopped, you get all the stack trace back, and all
  -	the local variables.</p>
  -
  -	<p>So instead of using beans to store things in session, you
  -	use normal variables in a program. Since each user has its own
  -	version of the program, all the local variables in the program
  -	are separate between users.</p>
  -
  -	<p>With this approach clicking the <em>Back</em> button in the
  -	browser is no longer a hassle to deal with for you as a
  -	server-side programmer. They will simply refer to past
  -	continuations objects, which have their own state of the local
  -	variables.</p>
  -
  -	<p>Since continuations are objects, you can also store them in
  -	a database, for really long-lived session, just like you do
  -	with session beans.</p>
  -  </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="Cocoon and continuations">
  +	<p>With continuations in the language, you can essentially
  +	store the continuation of <code>sendPageAndWait()</code> (think of all
  +	the stack trace, and the program counter), put it in a global
  +	hash table associated with an id. The id is then encoded in
  +	the <code>response.xml</code> page as an URL. When the user
  +	clicks on that URL, on the server side the associated
  +	continuation is resumed. Resuming the processing happens as if
  +	nothing was stopped, you get all the stack trace back, and all
  +	the local variables.</p>
  +
  +	<p>So instead of using beans to store things in session, you
  +	use normal variables in a program. Since each user has its own
  +	version of the program, all the local variables in the program
  +	are separate between users.</p>
  +
  +	<p>With this approach clicking the <em>Back</em> button in the
  +	browser is no longer a hassle to deal with for you as a
  +	server-side programmer. They will simply refer to past
  +	continuations objects, which have their own state of the local
  +	variables.</p>
  +
  +	<p>Since continuations are objects, you can also store them in
  +	a database, for really long-lived session, just like you do
  +	with session beans.</p>
  +  </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.8       +45 -45    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- index.xml	13 Jul 2003 01:39:54 -0000	1.7
  +++ index.xml	13 Jul 2003 18:33:27 -0000	1.8
  @@ -1,45 +1,45 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Apache Cocoon - Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -  <body>
  -    <s1 title="Control flow">
  -      <p>Cocoon has advanced control flow, the ability to describe the
  -      order of Web pages that have to be sent to the client, at any
  -      given point in time in an application.</p>
  -
  -      <p>Traditional Web applications try to model the control flow of
  -      a Web application by modeling the application as a finite state
  -      machine (FSM). In this model, the Web application is composed of
  -      multiple states, but the application can be only in one state at
  -      a time. Any request received by the application transitions it
  -      into a different state. During such a transition, the application
  -      may perform various side-effects, such as updating objects
  -      either in memory or in a database. Another important side-effect
  -      of such a transition is that a Web page is sent back to the
  -      client browser.</p>
  -
  -      <p>For simple Web applications, this model works fine. However,
  -      as the application grows, the number of states and transitions
  -      between them grows as well, and it becomes hard to visualize
  -      what's happening in the application.</p>
  -
  -      <p>Moreover, the interactions in some applications are more
  -      complex than a simple finite state machine. In such cases it's
  -      much easier to think of and implement the application as a program,
  -      rather than a FSM.</p>
  -
  -      <p>By using a high level programming concept called
  -      <em>continuations</em>, Cocoon tries to solve this problem, and
  -      promises to allow the control flow in Web applications to be
  -      modeled as a normal program.</p>
  -
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Apache Cocoon - Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +  <body>
  +    <s1 title="Control flow">
  +      <p>Cocoon has advanced control flow, the ability to describe the
  +      order of Web pages that have to be sent to the client, at any
  +      given point in time in an application.</p>
  +
  +      <p>Traditional Web applications try to model the control flow of
  +      a Web application by modeling the application as a finite state
  +      machine (FSM). In this model, the Web application is composed of
  +      multiple states, but the application can be only in one state at
  +      a time. Any request received by the application transitions it
  +      into a different state. During such a transition, the application
  +      may perform various side-effects, such as updating objects
  +      either in memory or in a database. Another important side-effect
  +      of such a transition is that a Web page is sent back to the
  +      client browser.</p>
  +
  +      <p>For simple Web applications, this model works fine. However,
  +      as the application grows, the number of states and transitions
  +      between them grows as well, and it becomes hard to visualize
  +      what's happening in the application.</p>
  +
  +      <p>Moreover, the interactions in some applications are more
  +      complex than a simple finite state machine. In such cases it's
  +      much easier to think of and implement the application as a program,
  +      rather than a FSM.</p>
  +
  +      <p>By using a high level programming concept called
  +      <em>continuations</em>, Cocoon tries to solve this problem, and
  +      promises to allow the control flow in Web applications to be
  +      modeled as a normal program.</p>
  +
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.15      +110 -110  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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- jpath.xml	13 Jul 2003 01:39:54 -0000	1.14
  +++ jpath.xml	13 Jul 2003 18:33:27 -0000	1.15
  @@ -1,110 +1,110 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -<document>
  -  <header>
  -   <title>Advanced Control Flow</title> 
  -   <authors>
  -    <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -   </authors>
  -  </header>
  -  <body>
  -   <s1 title="JPath Logic Sheet">
  -    <p>
  -     The JPath Logic Sheet is an <link href="../xsp/index.html">XSP</link> logic sheet that allows
  -     you to access data from a Cocoon Flowscript in an XSP page and inject it into a Cocoon
  -     pipeline. It provides a set of tags (similar to the those defined by
  -     <link href="http://www.w3.org/TR/xslt">XSLT</link>) that allow you to iterate over Java
  -     collections (and Java or JavaScript arrays) and to test for the presence of optional or
  -     alternate bean properties. It is based on
  -     <link href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</link>.
  -    </p>
  -   </s1>
  -   <s1 title ="Tags">
  -    <p>The JPath tags are defined in the namespace</p>
  -    <source>http://apache.org/xsp/jpath/1.0</source>
  -    <s2 title ="if">
  -     <p>The <code>if</code> tag allows the conditional execution of its body according to value of its <code>test</code> attribute:</p>
  -     <source>
  -&lt;if test="XPathExpression"&gt;
  -  body
  -&lt;/if&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;jpath:if test="cart/numberOfItems = 0"&gt;
  -  Your cart is empty
  -&lt;/jpath:if&gt;
  -     </source>
  -    </s2>
  -    <s2 title ="choose">
  -     <p>The <code>choose</code> tag performs conditional block execution by its embedded
  -        <code>when</code> sub tags. It renders the body of the first <code>when</code> tag whose
  -        <code>test</code> condition evaluates to true. If none of the <code>test</code> conditions
  -        of its nested <code>when</code> tags evaluate to <code>true</code>, then the body of its
  -        <code>otherwise</code> tag is evaluated, if present:</p>
  -     <source>
  -&lt;choose&gt;
  -  &lt;when test="XPathExpression"&gt;
  -    body
  -  &lt;/when&gt;+
  -  &lt;otherwise&gt;
  -    body
  -  &lt;/otherwise&gt;?
  -&lt;/choose&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;choose&gt;
  -  &lt;when test="not(user/loggedIn)"&gt;
  -     You're not logged in
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -     You're already logged in
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -     </source>
  -    </s2>
  -    <s2 title="value-of">
  -     <p>The <code>value-of</code> tag evaluates an expression and outputs the result of the evaluation:</p>
  -     <source>
  -&lt;value-of select="XPathExpression"/&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;value-of select="cart/numberOfItems"&gt;
  -     </source>
  -    </s2>
  -    <s2 title="for-each">
  -     <p>The <code>for-each</code> tag allows you to iterate over a collection of objects:</p>
  -     <source>
  -&lt;for-each select="XPathExpression"&gt;
  -  body
  -&lt;/for-each&gt;
  -     </source>
  -     <p>When using XPath expressions within <code>for-each</code> the current element is the
  -        context node and can be referenced with XPath dot operator:</p>
  -     <source>.</source>
  -     <p>Example:</p>
  -     <source>
  -&lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
  -   &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
  -&lt;/for-each&gt;
  -     </source>
  -    </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>
  -&lt;continuation [level="Number"]/&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
  -     </source>
  -    </s2>
  -   </s1>
  -  </body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +<document>
  +  <header>
  +   <title>Advanced Control Flow</title> 
  +   <authors>
  +    <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +   </authors>
  +  </header>
  +  <body>
  +   <s1 title="JPath Logic Sheet">
  +    <p>
  +     The JPath Logic Sheet is an <link href="../xsp/index.html">XSP</link> logic sheet that allows
  +     you to access data from a Cocoon Flowscript in an XSP page and inject it into a Cocoon
  +     pipeline. It provides a set of tags (similar to the those defined by
  +     <link href="http://www.w3.org/TR/xslt">XSLT</link>) that allow you to iterate over Java
  +     collections (and Java or JavaScript arrays) and to test for the presence of optional or
  +     alternate bean properties. It is based on
  +     <link href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</link>.
  +    </p>
  +   </s1>
  +   <s1 title ="Tags">
  +    <p>The JPath tags are defined in the namespace</p>
  +    <source>http://apache.org/xsp/jpath/1.0</source>
  +    <s2 title ="if">
  +     <p>The <code>if</code> tag allows the conditional execution of its body according to value of its <code>test</code> attribute:</p>
  +     <source>
  +&lt;if test="XPathExpression"&gt;
  +  body
  +&lt;/if&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;jpath:if test="cart/numberOfItems = 0"&gt;
  +  Your cart is empty
  +&lt;/jpath:if&gt;
  +     </source>
  +    </s2>
  +    <s2 title ="choose">
  +     <p>The <code>choose</code> tag performs conditional block execution by its embedded
  +        <code>when</code> sub tags. It renders the body of the first <code>when</code> tag whose
  +        <code>test</code> condition evaluates to true. If none of the <code>test</code> conditions
  +        of its nested <code>when</code> tags evaluate to <code>true</code>, then the body of its
  +        <code>otherwise</code> tag is evaluated, if present:</p>
  +     <source>
  +&lt;choose&gt;
  +  &lt;when test="XPathExpression"&gt;
  +    body
  +  &lt;/when&gt;+
  +  &lt;otherwise&gt;
  +    body
  +  &lt;/otherwise&gt;?
  +&lt;/choose&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;choose&gt;
  +  &lt;when test="not(user/loggedIn)"&gt;
  +     You're not logged in
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +     You're already logged in
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +     </source>
  +    </s2>
  +    <s2 title="value-of">
  +     <p>The <code>value-of</code> tag evaluates an expression and outputs the result of the evaluation:</p>
  +     <source>
  +&lt;value-of select="XPathExpression"/&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;value-of select="cart/numberOfItems"&gt;
  +     </source>
  +    </s2>
  +    <s2 title="for-each">
  +     <p>The <code>for-each</code> tag allows you to iterate over a collection of objects:</p>
  +     <source>
  +&lt;for-each select="XPathExpression"&gt;
  +  body
  +&lt;/for-each&gt;
  +     </source>
  +     <p>When using XPath expressions within <code>for-each</code> the current element is the
  +        context node and can be referenced with XPath dot operator:</p>
  +     <source>.</source>
  +     <p>Example:</p>
  +     <source>
  +&lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
  +   &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
  +&lt;/for-each&gt;
  +     </source>
  +    </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>
  +&lt;continuation [level="Number"]/&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
  +     </source>
  +    </s2>
  +   </s1>
  +  </body>
  +</document>
  
  
  
  1.14      +275 -275  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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- jxtemplate.xml	13 Jul 2003 01:39:54 -0000	1.13
  +++ jxtemplate.xml	13 Jul 2003 18:33:27 -0000	1.14
  @@ -1,275 +1,275 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -	<header>
  -		<title>Advanced Control Flow</title> 
  -		<authors>
  -			<person name="Christopher Oliver" email="coliver@apache.org" />
  -		</authors>
  -	</header>
  -<body>
  -	<s1 title="JXTemplate Generator">
  -  <p>
  -The JXTemplate Generator is a page template processor that allows you to inject data from Java and JavaScript objects passed by a Cocoon Flowscript into a Cocoon pipeline. It provides a set of tags (similar to the <link href="http://java.sun.com/products/jsp/jstl/">JSTL</link> core tags) that allow you to iterate over Java collections (and Java or JavaScript arrays) and to test for the presence of optional or alternate bean properties, as well as embedded expressions to specify conditions and to access the properties of objects. The <em>JX</em>Template Generator gets its name from the embedded expression languages it supports, namely <link href="http://jakarta.apache.org/commons/jxpath">Apache <em>JX</em>Path</link> and <link href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>X</em>l</link>. 
  -  </p>
  -<p>To use the JXTemplate Generator, add a generator entry to your <link href="../concepts/sitemap.html">sitemap</link> with the <code>src</code> attribute set to <code>org.apache.cocoon.generation.JXTemplateGenerator</code>, for example like this:</p>
  -<source>
  -&lt;map:generators&gt;
  -  &lt;map:generator label="content,data" 
  -      logger="sitemap.generator.jx" name="jx" 
  -         src="org.apache.cocoon.generation.JXTemplateGenerator"/&gt;
  -&lt;/map:generators&gt;
  -</source>
  -         </s1>
  -         <s1 title="Expression Languages">
  -  <p>
  -The JXTemplate Generator supports two embedded expression languages: <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> and <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link>. Apache <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> provides an extended version of the expression language of the <link href="http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html">JSTL</link>. Apache <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link> provides an interpreter of the <link href="http://www.w3.org/TR/xpath">XPath</link> expression language that can apply XPath expressions to graphs of Java objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
  - </p>
  -  <p>
  - Having an embedded expression language allows a page author to access an object using a simple syntax such as
  - </p>
  -<source>
  - &lt;site signOn="${accountForm.signOn}"&gt;
  - </source>
  -<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>
  -<dl>
  -<dt><link href="../../apidocs/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code> request</code></dt>
  -<dd><br/>The current Cocoon request<br/></dd>
  - 
  -<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code> response</code></dt>
  -<dd><br/>The Cocoon response associated with the current request<br/></dd>
  - 
  -<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code> session</code></dt>
  -<dd><br/>The Cocoon session associated with the current request<br/></dd>
  - 
  -<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code> context</code></dt>
  -<dd><br/>The Cocoon context associated with the current request<br/></dd>
  - 
  -<dt><br/><code>org.apache.avalon.framework.parameter.Parameter[]</code><code> parameters</code></dt>
  -<dd><br/>Any parameters passed to the generator in the pipeline<br/></dd>
  -</dl>
  -<p>
  -Jexl Example:</p>
  -<source>
  -  The content type of the current request is ${request.contentType}
  -</source>
  -<p>
  -JXPath Example:</p>
  -<source>
  -  The content type of the current request is #{$request/contentType}
  -</source>
  -<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>:</p>
  -<source>
  -   &lt;form action="${continuation.id}"&gt;
  -</source>
  -<p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  -<source>
  -    &lt;form action="${continuation.getContinuation(1).id}" >
  -</source>
  -<p>or using an XPath expression:</p>
  -<source>
  -    &lt;form action="#{getContinuation($continuation, 1)/id}" >
  -</source>
  -</s1>
  -<s1 title ="Tags">
  -<p>The JXTemplate Generator tags are defined in the namespace</p>
  -<source>
  -http://apache.org/cocoon/templates/jx/1.0
  -</source>
  -<s2 title ="template">
  -<p>The <code>template</code> tag defines a new template:</p><source>
  -   &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
  -       body
  -   &lt;/t:template&gt;
  -</source>
  -</s2>
  -<s2 title ="import"/>
  -<p>The <code>import</code> tag allows you to include another template within the current template. The content of the imported template is compiled and will be executed in place of the <code>import</code> tag:</p><source>
  -   &lt;import uri="URI" [context="Expression"]/&gt;
  -</source><p>The Cocoon source resolver is used to resolve <code>uri</code>. If <code>context</code> is present, then its value is used as the context for evaluating the imported template, otherwise the current context is used.</p>
  -<s2 title ="set">
  -<p>The <code>set</code> tag creates a local alias of an object. The <code>var</code> attribute specifies the name of a variable to assign the object to. The <code>value</code> attribute specifies the object (defaults to <code>body</code> if not present):</p><source>
  -   &lt;set var="Name" [value="Value"]&gt;
  -       [body]
  -   &lt;/set&gt;
  -</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>
  -<source>
  -&lt;set var="greeting" value="Hello ${user}"/&gt;
  -The value of greeting is ${greeting}
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;set var="greeting" value="Hello #{user}"/&gt;
  -The value of greeting is #{$greeting}
  -</source>
  -</s2>
  -<s2 title ="if">
  -<p>The <code>if</code> tag allows the conditional execution of its body 
  -according to value of its <code>test</code> attribute:</p>
  -<source>
  -  &lt;if test="Expression"&gt;
  -      body
  -  &lt;/if&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;if test="${cart.numberOfItems == 0}"&gt;
  -  Your cart is empty
  -&lt;/if&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;if test="#{cart/numberOfItems = 0}"&gt;
  -  Your cart is empty
  -&lt;/if&gt;
  -</source>
  -</s2>
  -<s2 title ="choose">
  -<p>The <code>choose</code> tag performs conditional block execution by its 
  -embedded <code>when</code> sub tags. It renders the body of the first 
  -<code>when</code> tag whose <code>test</code> condition evaluates to true. 
  -If none of the <code>test</code> conditions of its nested <code>when</code> tags
  -evaluate to <code>true</code>, then the body of its <code>otherwise</code> 
  -tag is evaluated, if present:</p>
  -<source>
  - &lt;choose&gt;
  -   &lt;when test="Expression"&gt;
  -      body
  -   &lt;/when&gt;+
  -   &lt;otherwise&gt;
  -      body
  -   &lt;/otherwise&gt;?
  - &lt;/choose&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;choose&gt;
  -  &lt;when test="${!user.loggedIn}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;choose&gt;
  -  &lt;when test="#{not(user/loggedIn)}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -</source>
  -</s2>
  -<s2 title="out">
  -<p>The <code>out</code> tag evaluates an expression and outputs 
  -the result of the evaluation:</p>
  -<source>
  -&lt;out value="Expression"/&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;out value="${cart.numberOfItems}"&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;out value="#{cart/numberOfItems}"&gt;
  -</source>
  -</s2>
  -<s2 title="forEach">
  -<p>The <code>forEach</code> tag allows you to iterate over a collection 
  -of objects:</p>
  -<source>
  -  &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]&gt;
  -    body
  - &lt;/forEach&gt;
  -</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> 
  -attribute specifies the item to end with (<code>0</code> = first item, 
  -<code>1</code> = second item, ...). If unspecified it defaults to the last item in the list. Every <code>step</code> items are
  -processed (defaults to <code>1</code> if <code>step</code> is absent). Either <code>items</code> or both <code>begin</code> and <code>end</code> must be present.</p>
  -<p>An alternate form of <code>forEach</code> is supported for convenience when using XPath (since you can specify the selection criteria for the collection using XPath itself):</p>
  -<source>
  -&lt;forEach select="XPathExpression"&gt;
  -  body
  -&lt;/forEach&gt;
  -</source>
  -<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>
  -&lt;forEach var="item" items="${cart.cartItems} begin="${start}" end="${count-start}" step="1""&gt;
  -   &lt;td&gt;${item.productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
  -   &lt;td&gt;#{./productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  -</source>
  -</s2>
  -<s2 title="macro"> 
  -<p>The <code>macro</code> tag allows you define a new custom tag.</p><source>
  -&lt;macro name="Name" [targetNamespace="Namespace"]&gt;
  -  &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
  -  body
  -
  -&lt;/macro&gt;
  -</source>
  - <p> For example:</p><source>
  -&lt;c:macro name="d"&gt;
  -  &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  -&lt;/c:macro&gt;
  -</source>
  -<p>The tag being defined in this example is <code>&lt;d&gt;</code> and it 
  -can be used like any other tag:</p><source>
  -  &lt;d/&gt;
  -</source>
  -<p>However, when this tag is used it will be replaced with a row containing a single empty data cell.</p>
  -<p> When such a tag is used, the attributes and content of the tag become available as variables in the body of the <code>macro</code>'s definition, for example:</p><source>
  -&lt;c:macro name="tablerows"&gt;
  -  &lt;c:parameter name="list"/&gt;
  -  &lt;c:parameter name="color"/&gt;
  -  &lt;c:forEach var="item" items="${list}"&gt;
  -    &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
  -  &lt;/c:forEach&gt;
  -&lt;/c:macro&gt;
  -</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>
  -&lt;table&gt;
  -   &lt;tablerows list="${greatlakes}" color="blue"/&gt;
  -&lt;/table&gt;
  -</source>
  -<p>When the <code>tablerows</code> tag is used in this situation the following output would be generated:
  -</p>
  - <source>
  -&lt;table&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
  -&lt;/table&gt;
  -</source>
  -</s2>
  -</s1>
  -</body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +	<header>
  +		<title>Advanced Control Flow</title> 
  +		<authors>
  +			<person name="Christopher Oliver" email="coliver@apache.org" />
  +		</authors>
  +	</header>
  +<body>
  +	<s1 title="JXTemplate Generator">
  +  <p>
  +The JXTemplate Generator is a page template processor that allows you to inject data from Java and JavaScript objects passed by a Cocoon Flowscript into a Cocoon pipeline. It provides a set of tags (similar to the <link href="http://java.sun.com/products/jsp/jstl/">JSTL</link> core tags) that allow you to iterate over Java collections (and Java or JavaScript arrays) and to test for the presence of optional or alternate bean properties, as well as embedded expressions to specify conditions and to access the properties of objects. The <em>JX</em>Template Generator gets its name from the embedded expression languages it supports, namely <link href="http://jakarta.apache.org/commons/jxpath">Apache <em>JX</em>Path</link> and <link href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>X</em>l</link>. 
  +  </p>
  +<p>To use the JXTemplate Generator, add a generator entry to your <link href="../concepts/sitemap.html">sitemap</link> with the <code>src</code> attribute set to <code>org.apache.cocoon.generation.JXTemplateGenerator</code>, for example like this:</p>
  +<source>
  +&lt;map:generators&gt;
  +  &lt;map:generator label="content,data" 
  +      logger="sitemap.generator.jx" name="jx" 
  +         src="org.apache.cocoon.generation.JXTemplateGenerator"/&gt;
  +&lt;/map:generators&gt;
  +</source>
  +         </s1>
  +         <s1 title="Expression Languages">
  +  <p>
  +The JXTemplate Generator supports two embedded expression languages: <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> and <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link>. Apache <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> provides an extended version of the expression language of the <link href="http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html">JSTL</link>. Apache <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link> provides an interpreter of the <link href="http://www.w3.org/TR/xpath">XPath</link> expression language that can apply XPath expressions to graphs of Java objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
  + </p>
  +  <p>
  + Having an embedded expression language allows a page author to access an object using a simple syntax such as
  + </p>
  +<source>
  + &lt;site signOn="${accountForm.signOn}"&gt;
  + </source>
  +<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>
  +<dl>
  +<dt><link href="../../apidocs/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code> request</code></dt>
  +<dd><br/>The current Cocoon request<br/></dd>
  + 
  +<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code> response</code></dt>
  +<dd><br/>The Cocoon response associated with the current request<br/></dd>
  + 
  +<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code> session</code></dt>
  +<dd><br/>The Cocoon session associated with the current request<br/></dd>
  + 
  +<dt><br/><link href="../../apidocs/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code> context</code></dt>
  +<dd><br/>The Cocoon context associated with the current request<br/></dd>
  + 
  +<dt><br/><code>org.apache.avalon.framework.parameter.Parameter[]</code><code> parameters</code></dt>
  +<dd><br/>Any parameters passed to the generator in the pipeline<br/></dd>
  +</dl>
  +<p>
  +Jexl Example:</p>
  +<source>
  +  The content type of the current request is ${request.contentType}
  +</source>
  +<p>
  +JXPath Example:</p>
  +<source>
  +  The content type of the current request is #{$request/contentType}
  +</source>
  +<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>:</p>
  +<source>
  +   &lt;form action="${continuation.id}"&gt;
  +</source>
  +<p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  +<source>
  +    &lt;form action="${continuation.getContinuation(1).id}" >
  +</source>
  +<p>or using an XPath expression:</p>
  +<source>
  +    &lt;form action="#{getContinuation($continuation, 1)/id}" >
  +</source>
  +</s1>
  +<s1 title ="Tags">
  +<p>The JXTemplate Generator tags are defined in the namespace</p>
  +<source>
  +http://apache.org/cocoon/templates/jx/1.0
  +</source>
  +<s2 title ="template">
  +<p>The <code>template</code> tag defines a new template:</p><source>
  +   &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
  +       body
  +   &lt;/t:template&gt;
  +</source>
  +</s2>
  +<s2 title ="import"/>
  +<p>The <code>import</code> tag allows you to include another template within the current template. The content of the imported template is compiled and will be executed in place of the <code>import</code> tag:</p><source>
  +   &lt;import uri="URI" [context="Expression"]/&gt;
  +</source><p>The Cocoon source resolver is used to resolve <code>uri</code>. If <code>context</code> is present, then its value is used as the context for evaluating the imported template, otherwise the current context is used.</p>
  +<s2 title ="set">
  +<p>The <code>set</code> tag creates a local alias of an object. The <code>var</code> attribute specifies the name of a variable to assign the object to. The <code>value</code> attribute specifies the object (defaults to <code>body</code> if not present):</p><source>
  +   &lt;set var="Name" [value="Value"]&gt;
  +       [body]
  +   &lt;/set&gt;
  +</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>
  +<source>
  +&lt;set var="greeting" value="Hello ${user}"/&gt;
  +The value of greeting is ${greeting}
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;set var="greeting" value="Hello #{user}"/&gt;
  +The value of greeting is #{$greeting}
  +</source>
  +</s2>
  +<s2 title ="if">
  +<p>The <code>if</code> tag allows the conditional execution of its body 
  +according to value of its <code>test</code> attribute:</p>
  +<source>
  +  &lt;if test="Expression"&gt;
  +      body
  +  &lt;/if&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;if test="${cart.numberOfItems == 0}"&gt;
  +  Your cart is empty
  +&lt;/if&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;if test="#{cart/numberOfItems = 0}"&gt;
  +  Your cart is empty
  +&lt;/if&gt;
  +</source>
  +</s2>
  +<s2 title ="choose">
  +<p>The <code>choose</code> tag performs conditional block execution by its 
  +embedded <code>when</code> sub tags. It renders the body of the first 
  +<code>when</code> tag whose <code>test</code> condition evaluates to true. 
  +If none of the <code>test</code> conditions of its nested <code>when</code> tags
  +evaluate to <code>true</code>, then the body of its <code>otherwise</code> 
  +tag is evaluated, if present:</p>
  +<source>
  + &lt;choose&gt;
  +   &lt;when test="Expression"&gt;
  +      body
  +   &lt;/when&gt;+
  +   &lt;otherwise&gt;
  +      body
  +   &lt;/otherwise&gt;?
  + &lt;/choose&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;choose&gt;
  +  &lt;when test="${!user.loggedIn}"&gt;
  +    &lt;set var="label" value="Log in"&gt;
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +    &lt;set var="label" value="Log out"&gt;
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;choose&gt;
  +  &lt;when test="#{not(user/loggedIn)}"&gt;
  +    &lt;set var="label" value="Log in"&gt;
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +    &lt;set var="label" value="Log out"&gt;
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +</source>
  +</s2>
  +<s2 title="out">
  +<p>The <code>out</code> tag evaluates an expression and outputs 
  +the result of the evaluation:</p>
  +<source>
  +&lt;out value="Expression"/&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;out value="${cart.numberOfItems}"&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;out value="#{cart/numberOfItems}"&gt;
  +</source>
  +</s2>
  +<s2 title="forEach">
  +<p>The <code>forEach</code> tag allows you to iterate over a collection 
  +of objects:</p>
  +<source>
  +  &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]&gt;
  +    body
  + &lt;/forEach&gt;
  +</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> 
  +attribute specifies the item to end with (<code>0</code> = first item, 
  +<code>1</code> = second item, ...). If unspecified it defaults to the last item in the list. Every <code>step</code> items are
  +processed (defaults to <code>1</code> if <code>step</code> is absent). Either <code>items</code> or both <code>begin</code> and <code>end</code> must be present.</p>
  +<p>An alternate form of <code>forEach</code> is supported for convenience when using XPath (since you can specify the selection criteria for the collection using XPath itself):</p>
  +<source>
  +&lt;forEach select="XPathExpression"&gt;
  +  body
  +&lt;/forEach&gt;
  +</source>
  +<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>
  +&lt;forEach var="item" items="${cart.cartItems} begin="${start}" end="${count-start}" step="1""&gt;
  +   &lt;td&gt;${item.productId}&lt;/td&gt;
  +&lt;/forEach&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
  +   &lt;td&gt;#{./productId}&lt;/td&gt;
  +&lt;/forEach&gt;
  +</source>
  +</s2>
  +<s2 title="macro"> 
  +<p>The <code>macro</code> tag allows you define a new custom tag.</p><source>
  +&lt;macro name="Name" [targetNamespace="Namespace"]&gt;
  +  &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
  +  body
  +
  +&lt;/macro&gt;
  +</source>
  + <p> For example:</p><source>
  +&lt;c:macro name="d"&gt;
  +  &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  +&lt;/c:macro&gt;
  +</source>
  +<p>The tag being defined in this example is <code>&lt;d&gt;</code> and it 
  +can be used like any other tag:</p><source>
  +  &lt;d/&gt;
  +</source>
  +<p>However, when this tag is used it will be replaced with a row containing a single empty data cell.</p>
  +<p> When such a tag is used, the attributes and content of the tag become available as variables in the body of the <code>macro</code>'s definition, for example:</p><source>
  +&lt;c:macro name="tablerows"&gt;
  +  &lt;c:parameter name="list"/&gt;
  +  &lt;c:parameter name="color"/&gt;
  +  &lt;c:forEach var="item" items="${list}"&gt;
  +    &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
  +  &lt;/c:forEach&gt;
  +&lt;/c:macro&gt;
  +</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>
  +&lt;table&gt;
  +   &lt;tablerows list="${greatlakes}" color="blue"/&gt;
  +&lt;/table&gt;
  +</source>
  +<p>When the <code>tablerows</code> tag is used in this situation the following output would be generated:
  +</p>
  + <source>
  +&lt;table&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
  +&lt;/table&gt;
  +</source>
  +</s2>
  +</s1>
  +</body>
  +</document>
  
  
  
  1.13      +76 -76    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- sitemap.xml	13 Jul 2003 01:39:54 -0000	1.12
  +++ sitemap.xml	13 Jul 2003 18:33:27 -0000	1.13
  @@ -1,76 +1,76 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -      <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="Sitemap">
  -    <p>The Cocoon <link href="../concepts/sitemap.html">Sitemap</link> provides two 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>
  -      <source><![CDATA[
  -        <map:flow language="Language">
  -           <map:script src="URI"/>+
  -        </map:flow>
  -      ]]></source>
  -    <p>Example:</p>
  -      <source><![CDATA[
  -        <map:flow language="JavaScript">
  -           <map:script src="myApplication.js"/>
  -        </map:flow>
  -      ]]></source>
  -      </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>
  -      <s3 title="function"><anchor id="callFunction"/>
  -      <p>If the <code>function</code> attribute is present, then the Sitemap will invoke a top-level function defined in your Flowscript. The <code>function</code> attribute specifies the name of the function. Zero or more nested <code>parameter</code> elements may be provided to pass arguments to the function.</p>
  -      <source><![CDATA[
  -        <map:call function="FunctionName">
  -           <map:parameter name="Name" value="Value"/>*
  -        </map:call>
  -      ]]></source>
  -      <p>Example:</p>
  -      <source><![CDATA[
  -        <map:flow language="JavaScript">
  -           <map:script src="myApplication.js"/>
  -        </map:flow>
  -        <map:pipelines>
  -           <map:pipeline>
  -              <map:match pattern="index.html">
  -                 <map:call function="showIndexPage"/>
  -              </map:match>
  -           </map:pipeline>
  -        </map:pipelines>
  -      ]]></source>
  -      <p>Then in <code>myApplication.js</code> you would define a JavaScript function called <code>showIndexPage()</code> such as:</p>
  -      <source><![CDATA[
  -        function showIndexPage() { 
  -            var param = cocoon.request.get("paramName");
  -            sendPage("private/index.html", {param: param});
  -        }
  -      ]]></source>
  -      </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>
  -      <source><![CDATA[
  -        <map:call continuation="Id"/>
  -      ]]></source>
  -      <p>Example:</p>
  -      <source><![CDATA[
  -        <map:match pattern="*.form">
  -          <map:call continuation="{1}"/>
  -        </map:match>
  -      ]]></source>
  -      </s3>
  -      </s2>
  -    </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +      <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="Sitemap">
  +    <p>The Cocoon <link href="../concepts/sitemap.html">Sitemap</link> provides two 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>
  +      <source><![CDATA[
  +        <map:flow language="Language">
  +           <map:script src="URI"/>+
  +        </map:flow>
  +      ]]></source>
  +    <p>Example:</p>
  +      <source><![CDATA[
  +        <map:flow language="javascript">
  +           <map:script src="myApplication.js"/>
  +        </map:flow>
  +      ]]></source>
  +      </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>
  +      <s3 title="function"><anchor id="callFunction"/>
  +      <p>If the <code>function</code> attribute is present, then the Sitemap will invoke a top-level function defined in your Flowscript. The <code>function</code> attribute specifies the name of the function. Zero or more nested <code>parameter</code> elements may be provided to pass arguments to the function.</p>
  +      <source><![CDATA[
  +        <map:call function="FunctionName">
  +           <map:parameter name="Name" value="Value"/>*
  +        </map:call>
  +      ]]></source>
  +      <p>Example:</p>
  +      <source><![CDATA[
  +        <map:flow language="javascript">
  +           <map:script src="myApplication.js"/>
  +        </map:flow>
  +        <map:pipelines>
  +           <map:pipeline>
  +              <map:match pattern="index.html">
  +                 <map:call function="showIndexPage"/>
  +              </map:match>
  +           </map:pipeline>
  +        </map:pipelines>
  +      ]]></source>
  +      <p>Then in <code>myApplication.js</code> you would define a JavaScript function called <code>showIndexPage()</code> such as:</p>
  +      <source><![CDATA[
  +        function showIndexPage() { 
  +            var param = cocoon.request.get("paramName");
  +            sendPage("private/index.html", {param: param});
  +        }
  +      ]]></source>
  +      </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>
  +      <source><![CDATA[
  +        <map:call continuation="Id"/>
  +      ]]></source>
  +      <p>Example:</p>
  +      <source><![CDATA[
  +        <map:match pattern="*.form">
  +          <map:call continuation="{1}"/>
  +        </map:match>
  +      ]]></source>
  +      </s3>
  +      </s2>
  +    </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.11      +175 -175  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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- using.xml	13 Jul 2003 01:39:54 -0000	1.10
  +++ using.xml	13 Jul 2003 18:33:27 -0000	1.11
  @@ -1,175 +1,175 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -  <s1 title="Using Cocoon's Control Flow">
  -  <p>
  -    The general flow of actions in an application which uses the control flow
  -    is as described below.
  -  </p>
  - 
  -  <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:</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>&lt;map:call&nbsp;function="function-name"/&gt;</code></link>
  -      construction.
  -    </li>
  -    <li>
  -      To restart the computation of a previously stopped function, you use
  -      the <link href="sitemap.html#callContinuation"><code>&lt;map:call&nbsp;continuation="..."/&gt;</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
  -    effectively inside the Control Flow. Here you have access to the request
  -    parameters, and to the business logic objects. The controller script
  -    takes the appropriate actions to invoke the business logic, usually
  -    written in Java, creating objects, setting various values on them etc...
  -  </p>
  - 
  -  <p>
  -    When the business logic is invoked, you're inside the Model. The business
  -    logic takes whatever actions are needed, accessing a database, making a
  -    SOAP request to a Web service etc. When this logic finishes, the program
  -    control goes back to the Control Flow.
  -  </p>
  - 
  -  <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 one of the
  -    <link href="api.html#sendPageAndWait"><code>cocoon.sendPageAndWait()</code></link> or <link href="api.html#sendPage"><code>cocoon.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
  -    generated page.
  -  </p>
  - 
  -  <p>
  -    The second argument to <code>cocoon.sendPageAndWait()</code> and
  -    <code>cocoon.sendPage()</code> is a context object, which can be a
  -    simple dictionary with values that need to be displayed by the View. More
  -    generally any Java or JavaScript object can be passed here, as long as
  -    the necessary get methods for the important values are provided.
  -  </p>
  - 
  -  <p>
  -    The page specified by the URL is processed by the sitemap, using the
  -    normal sitemap rules. The simplest case is a <link href="views.html">generator</link> followed by
  -    an XSLT transformation and a serializer. This page generation is part of
  -    the View layer. To process a page you can make use of several
  -    Cocoon <link href="views.html">generators</link> to retrieve values from the context objects passed by the
  -    Control Flow.
  -  </p>
  - 
  -  <p>
  -    Going back to the <code>cocoon.sendPageAndWait()</code> and
  -    <code>sendPage()</code> functions, there is a big difference
  -    between them. The first function will send the response back to the
  -    client browser, and will stop the processing of the JavaScript script by
  -    saving it into a continuation object. The other function,
  -    <code>cocoon.sendPage()</code> will send the response, but it will not
  -    stop the computation. This is useful for example when you need to exit a
  -    top-level JavaScript function invoked with
  -    <code>&lt;map:call&nbsp;function="..."/&gt;</code>.
  -  </p>
  - 
  -  <p>
  -    The above explains how MVC could be really achieved in Cocoon with the
  -    control flow layer. Note that there is no direct communication between
  -    Model and View, everything is directed by the Control Flow by passing to
  -    View a context object constructed from Model data.
  -  </p>
  - 
  -  <s2 title="Basic usage">
  - 
  -  <p>
  -    As hinted in the previous section, an application using Cocoon's MVC
  -    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 <link href="views.html">page templates</link>, 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
  -    sequences of pages which are composed together. The natural analogy is to
  -    describe these sequences in separate JavaScript functions, which can then
  -    be called either from the sitemap, can call each other freely.
  -  </p>
  - 
  -  <p>
  -    An example of such an application is the user login and preferences
  -    sample 
  -  </p>
  - 
  -  <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,
  -    but in order for a user to use the application, (s)he must login first.
  -    Once the user logs in, we want to maintain the Java User object which
  -    represents the user between top-level function invocations.
  -  </p>
  -  <p>
  -    Even if you don't need complex control flow in your application, you may
  -    still choose to use the MVC pattern described above. You can have top-
  -    level JavaScript functions which obtain the request parameters, invoke
  -    the business logic and then call <code>cocoon.sendPage()</code> to
  -    generate a response page and return from the computation. Since there's
  -    no continuation object being created by this function, and no global
  -    scope being saved, there's no memory resource being eaten. The approach
  -    provides a clean way of separating logic and content, and makes things
  -    easy to follow, since you have to look at a single script to understand
  -    what's going on.
  -  </p>
  -  </s2>
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +  <s1 title="Using Cocoon's Control Flow">
  +  <p>
  +    The general flow of actions in an application which uses the control flow
  +    is as described below.
  +  </p>
  + 
  +  <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:</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>&lt;map:call&nbsp;function="function-name"/&gt;</code></link>
  +      construction.
  +    </li>
  +    <li>
  +      To restart the computation of a previously stopped function, you use
  +      the <link href="sitemap.html#callContinuation"><code>&lt;map:call&nbsp;continuation="..."/&gt;</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
  +    effectively inside the Control Flow. Here you have access to the request
  +    parameters, and to the business logic objects. The controller script
  +    takes the appropriate actions to invoke the business logic, usually
  +    written in Java, creating objects, setting various values on them etc...
  +  </p>
  + 
  +  <p>
  +    When the business logic is invoked, you're inside the Model. The business
  +    logic takes whatever actions are needed, accessing a database, making a
  +    SOAP request to a Web service etc. When this logic finishes, the program
  +    control goes back to the Control Flow.
  +  </p>
  + 
  +  <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 one of the
  +    <link href="api.html#sendPageAndWait"><code>cocoon.sendPageAndWait()</code></link> or <link href="api.html#sendPage"><code>cocoon.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
  +    generated page.
  +  </p>
  + 
  +  <p>
  +    The second argument to <code>cocoon.sendPageAndWait()</code> and
  +    <code>cocoon.sendPage()</code> is a context object, which can be a
  +    simple dictionary with values that need to be displayed by the View. More
  +    generally any Java or JavaScript object can be passed here, as long as
  +    the necessary get methods for the important values are provided.
  +  </p>
  + 
  +  <p>
  +    The page specified by the URL is processed by the sitemap, using the
  +    normal sitemap rules. The simplest case is a <link href="views.html">generator</link> followed by
  +    an XSLT transformation and a serializer. This page generation is part of
  +    the View layer. To process a page you can make use of several
  +    Cocoon <link href="views.html">generators</link> to retrieve values from the context objects passed by the
  +    Control Flow.
  +  </p>
  + 
  +  <p>
  +    Going back to the <code>cocoon.sendPageAndWait()</code> and
  +    <code>sendPage()</code> functions, there is a big difference
  +    between them. The first function will send the response back to the
  +    client browser, and will stop the processing of the JavaScript script by
  +    saving it into a continuation object. The other function,
  +    <code>cocoon.sendPage()</code> will send the response, but it will not
  +    stop the computation. This is useful for example when you need to exit a
  +    top-level JavaScript function invoked with
  +    <code>&lt;map:call&nbsp;function="..."/&gt;</code>.
  +  </p>
  + 
  +  <p>
  +    The above explains how MVC could be really achieved in Cocoon with the
  +    control flow layer. Note that there is no direct communication between
  +    Model and View, everything is directed by the Control Flow by passing to
  +    View a context object constructed from Model data.
  +  </p>
  + 
  +  <s2 title="Basic usage">
  + 
  +  <p>
  +    As hinted in the previous section, an application using Cocoon's MVC
  +    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 <link href="views.html">page templates</link>, 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
  +    sequences of pages which are composed together. The natural analogy is to
  +    describe these sequences in separate JavaScript functions, which can then
  +    be called either from the sitemap, can call each other freely.
  +  </p>
  + 
  +  <p>
  +    An example of such an application is the user login and preferences
  +    sample 
  +  </p>
  + 
  +  <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,
  +    but in order for a user to use the application, (s)he must login first.
  +    Once the user logs in, we want to maintain the Java User object which
  +    represents the user between top-level function invocations.
  +  </p>
  +  <p>
  +    Even if you don't need complex control flow in your application, you may
  +    still choose to use the MVC pattern described above. You can have top-
  +    level JavaScript functions which obtain the request parameters, invoke
  +    the business logic and then call <code>cocoon.sendPage()</code> to
  +    generate a response page and return from the computation. Since there's
  +    no continuation object being created by this function, and no global
  +    scope being saved, there's no memory resource being eaten. The approach
  +    provides a clean way of separating logic and content, and makes things
  +    easy to follow, since you have to look at a single script to understand
  +    what's going on.
  +  </p>
  +  </s2>
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.14      +59 -59    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- velocity.xml	13 Jul 2003 01:39:54 -0000	1.13
  +++ velocity.xml	13 Jul 2003 18:33:27 -0000	1.14
  @@ -1,59 +1,59 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -<document>
  - <header>
  -  <title>Advanced Control Flow</title> 
  -  <authors>
  -   <person name="Christopher Oliver" email="coliver@apache.org" />
  -   <person name="Ovidiu Predescu" email="ovidiu@apache.org" />
  -  </authors>
  - </header>
  - <body>
  -  <s1 title="Velocity Generator">
  -   <p>If called from a Flowscript, the Cocoon
  -    <link href="http://jakarta.apache.org/velocity">Velocity</link>
  -    <link href="../generators/velocity-generator.html">Generator</link>
  -    provides access to the immediate properties of the context object passed to
  -    <link href="api.html#sendPage"><code>sendPage</code></link> and
  -    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link>. In addition,
  -    the current <link href="api.html#WebContinuation"><code>WebContinuation</code></link>
  -    is also available as a variable named <code>$continuation</code>. You would typically access
  -    its <code>id</code>:</p>
  -   <source>
  -  &lt;form action="$continuation.id"&gt;
  -   </source>
  -   <p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  -   <source>
  -  &lt;form action="$continuation.getContinuation(1).id" &gt;
  -   </source>
  -   <p>In addition the following implicit objects are always available in the Velocity context:</p>
  -   <dl>
  -    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Request.html">org.apache.cocoon.environment.Request</link> <code>$request</code> </dt>
  -    <dd>The current Cocoon request</dd>
  -    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Response.html">org.apache.cocoon.environment.Response</link> <code>$response</code> </dt>
  -    <dd>The Cocoon response associated with the current request</dd>
  -    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Session.html">org.apache.cocoon.environment.Session</link> <code>$session</code> </dt>
  -    <dd>The Cocoon session associated with the current request</dd>
  -    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Context.html">org.apache.cocoon.environment.Context</link> <code>$context</code> </dt>
  -    <dd>The Cocoon context associated with the current request</dd>
  -    <dt><code>org.apache.avalon.framework.parameters.Parameters</code> <code>$parameters</code> </dt>
  -    <dd>Any parameters passed to the generator in the pipeline</dd>
  -   </dl>
  -   <p>
  -   Cocoon installs a Velocity introspector that makes it possible for you
  -   to access JavaScript objects and arrays in your templates, as well as Java objects. For example, assuming you had a Flowscript like this:</p>
  -   <source>
  -    sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
  -   </source>
  -   <p>
  -    You could do this in <code>myTemplate.vm</code>:</p>
  -    <source>
  -    &lt;select name="colors"&gt;
  -    #foreach ($color in $colors) 
  -      &lt;option value="$color"&gt;$color&lt;/option&gt;
  -    #end
  -    &lt;/select&gt;
  -    </source>
  -  </s1>
  - </body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +<document>
  + <header>
  +  <title>Advanced Control Flow</title> 
  +  <authors>
  +   <person name="Christopher Oliver" email="coliver@apache.org" />
  +   <person name="Ovidiu Predescu" email="ovidiu@apache.org" />
  +  </authors>
  + </header>
  + <body>
  +  <s1 title="Velocity Generator">
  +   <p>If called from a Flowscript, the Cocoon
  +    <link href="http://jakarta.apache.org/velocity">Velocity</link>
  +    <link href="../generators/velocity-generator.html">Generator</link>
  +    provides access to the immediate properties of the context object passed to
  +    <link href="api.html#sendPage"><code>sendPage</code></link> and
  +    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link>. In addition,
  +    the current <link href="api.html#WebContinuation"><code>WebContinuation</code></link>
  +    is also available as a variable named <code>$continuation</code>. You would typically access
  +    its <code>id</code>:</p>
  +   <source>
  +  &lt;form action="$continuation.id"&gt;
  +   </source>
  +   <p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  +   <source>
  +  &lt;form action="$continuation.getContinuation(1).id" &gt;
  +   </source>
  +   <p>In addition the following implicit objects are always available in the Velocity context:</p>
  +   <dl>
  +    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Request.html">org.apache.cocoon.environment.Request</link> <code>$request</code> </dt>
  +    <dd>The current Cocoon request</dd>
  +    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Response.html">org.apache.cocoon.environment.Response</link> <code>$response</code> </dt>
  +    <dd>The Cocoon response associated with the current request</dd>
  +    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Session.html">org.apache.cocoon.environment.Session</link> <code>$session</code> </dt>
  +    <dd>The Cocoon session associated with the current request</dd>
  +    <dt><link href="../../apidocs/java/org/apache/cocoon/environment/Context.html">org.apache.cocoon.environment.Context</link> <code>$context</code> </dt>
  +    <dd>The Cocoon context associated with the current request</dd>
  +    <dt><code>org.apache.avalon.framework.parameters.Parameters</code> <code>$parameters</code> </dt>
  +    <dd>Any parameters passed to the generator in the pipeline</dd>
  +   </dl>
  +   <p>
  +   Cocoon installs a Velocity introspector that makes it possible for you
  +   to access JavaScript objects and arrays in your templates, as well as Java objects. For example, assuming you had a Flowscript like this:</p>
  +   <source>
  +    sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
  +   </source>
  +   <p>
  +    You could do this in <code>myTemplate.vm</code>:</p>
  +    <source>
  +    &lt;select name="colors"&gt;
  +    #foreach ($color in $colors) 
  +      &lt;option value="$color"&gt;$color&lt;/option&gt;
  +    #end
  +    &lt;/select&gt;
  +    </source>
  +  </s1>
  + </body>
  +</document>
  
  
  
  1.10      +31 -31    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- views.xml	13 Jul 2003 01:39:54 -0000	1.9
  +++ views.xml	13 Jul 2003 18:33:27 -0000	1.10
  @@ -1,31 +1,31 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  - <header>
  -  <title>Advanced Control Flow</title>
  -  <authors>
  -   <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -   <person name="Christopher Oliver" email="coliver@apache.org"/>
  -  </authors>
  - </header>
  - <body>
  -  <s1 title="Flowscript-aware Generators and Form Frameworks">
  -   <p>The second argument to <link href="api.html#sendPage"><code>cocoon.sendPage()</code></link> and
  -    <link href="api.html#sendPageAndWait"><code>cocoon.sendPageAndWait()</code></link> is a context object,
  -    which can be a simple dictionary with values that need to be displayed by the page. More
  -    generally any Java or JavaScript object can be passed here, as long as the necessary <em>get</em>
  -    methods for the important values are provided.</p>
  -   <p>The page specified by the URL is processed by the sitemap, using the normal sitemap rules.</p>
  -   <p>Several Cocoon generators are provided that allow you to access the context object and inject
  -    its values into a pipeline. Currently, these are the
  -    <link href="jxtemplate.html">JXTemplate Generator</link>,
  -    <link href="jpath.html">JPath XSP Logic Sheet</link> and
  -    <link href="velocity.html">Velocity Generator</link>.
  -   </p>
  -   <p>
  -     In addition, Cocoon provides several higher-level frameworks to create single and multi-page forms that can be used with your Flowscripts. Currently, these are <link href="jxforms.html">JXForms</link> and <link href="woody.html">Woody</link>.
  -   </p>
  -  </s1>
  - </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  + <header>
  +  <title>Advanced Control Flow</title>
  +  <authors>
  +   <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +   <person name="Christopher Oliver" email="coliver@apache.org"/>
  +  </authors>
  + </header>
  + <body>
  +  <s1 title="Flowscript-aware Generators and Form Frameworks">
  +   <p>The second argument to <link href="api.html#sendPage"><code>cocoon.sendPage()</code></link> and
  +    <link href="api.html#sendPageAndWait"><code>cocoon.sendPageAndWait()</code></link> is a context object,
  +    which can be a simple dictionary with values that need to be displayed by the page. More
  +    generally any Java or JavaScript object can be passed here, as long as the necessary <em>get</em>
  +    methods for the important values are provided.</p>
  +   <p>The page specified by the URL is processed by the sitemap, using the normal sitemap rules.</p>
  +   <p>Several Cocoon generators are provided that allow you to access the context object and inject
  +    its values into a pipeline. Currently, these are the
  +    <link href="jxtemplate.html">JXTemplate Generator</link>,
  +    <link href="jpath.html">JPath XSP Logic Sheet</link> and
  +    <link href="velocity.html">Velocity Generator</link>.
  +   </p>
  +   <p>
  +     In addition, Cocoon provides several higher-level frameworks to create single and multi-page forms that can be used with your Flowscripts. Currently, these are <link href="jxforms.html">JXForms</link> and <link href="woody.html">Woody</link>.
  +   </p>
  +  </s1>
  + </body>
  +</document>
  
  
  

Mime
View raw message