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/java/org/apache/cocoon/components/flow/javascript/fom fom_system.js
Date Sat, 10 Jan 2004 00:04:37 GMT
coliver     2004/01/09 16:04:37

  Modified:    src/documentation/xdocs/userdocs/flow api.xml
               src/java/org/apache/cocoon/components/flow/javascript/fom
                        fom_system.js
  Log:
  Added function parameter to sendPageAndWait which will execute after pipeline processing
but before the script is suspended
  
  Revision  Changes    Path
  1.31      +17 -1     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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- api.xml	27 Dec 2003 07:30:42 -0000	1.30
  +++ api.xml	10 Jan 2004 00:04:37 -0000	1.31
  @@ -91,7 +91,7 @@
       </s3>
       <s3 title = "sendPageAndWait"><anchor id="sendPageAndWait"/>
       <p>
  -    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String]
uri, [Object] bean, [Number] timeToLive)</code>
  +    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String]
uri, [Object] bean, [Function] postPipelineCode, [Number] timeToLive)</code>
       </p>
        <p>
        Passes control to the Cocoon sitemap to generate the output page.
  @@ -102,6 +102,22 @@
         <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>
  +     <p>If provided, the <code>postPipelineCode</code> function will
be executed after pipeline processing is complete but before the script is suspended. You
can use this to release resources that are needed during the pipeline processing but should
not become part of the continuation. For example:</p>
  +<source>
  +
  +function processPage() {
  +   var id = ...
  +   var bizData = ...
  +   var uri = ...
  +   var comp = cocoon.getComponent(id);
  +   // use comp
  +   ...
  +   cocoon.sendPageAndWait(uri, bizData, function() {
  +      cocoon.releaseComponent(comp);
  +      comp = null;
  +   });
  +}
  +</source>
        <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>
  
  
  
  1.2       +4 -1      cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/fom_system.js
  
  Index: fom_system.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/fom_system.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fom_system.js	8 Jul 2003 05:48:52 -0000	1.1
  +++ fom_system.js	10 Jan 2004 00:04:37 -0000	1.2
  @@ -1,7 +1,10 @@
   FOM_Cocoon.suicide = new Continuation();
   
  -FOM_Cocoon.prototype.sendPageAndWait = function(uri, bizData) {
  +FOM_Cocoon.prototype.sendPageAndWait = function(uri, bizData, fun) {
       this.sendPage(uri, bizData, new Continuation());
  +    if (fun instanceof Function) {
  +      fun();
  +    }
       FOM_Cocoon.suicide();
   }
   
  
  
  

Mime
View raw message