Helma Logo
main list history
previous version  overview  next version

Version 5 by hannes on 05. February 2008, 16:09

=== Rhino Continuations

Rhino continuations allow to capture the state of a complete running script to be resumed later on.

http://wiki.apache.org/cocoon/RhinoWithContinuations

Rhino continuations only work in interpreter mode with the compiler disabled, i.e. with optlevel -1.

Rhino continuations can be made While adding continuation and callback support to work quite easily in existing Helma 1.6releases has been a bit of a hack, using for example the callback feature from Gobi's Markup.js. Interestinglyrecent Helma snapshots have added features to make that easier, namely the req/res references work correctly out introduction of the box for resumed continuations, probably due to the way Rhino implements dynamic scopes (i*req.euri|https://dev. the per-thread scope is looked up at runtime anyway)helma.org/trac/helma/changeset/8774* and *req.actionProcessor|https://dev.helma.org/trac/helma/changeset/8775*.

What needs more work is serialization support. Persistent HopObjects shouldn't be included in a serialized continuation, so we need The following framework makes use of these features to convert Nodes into NodeHandles allow storing suspended functions in the output stream, and convert back to Nodes in the input stream. The latter currently fails in user's session restore because it requires object and resuming them at a Transactor thread. For global references we need to make sure they're excluded from serialization. Helma 1.7 seems like a good timeframe to fix these issues.later time:

<% this.attachments %>

Here's an example action that makes use of this framework:

  function test_continuation_action() {
    res.write(<form method="post" action={ Continuation.nextUrl() }>
                <input name="foo"/>
                <input type="submit"/>
              </form>);
    Continuation.nextPage();
    var foo = req.data.foo;
    res.write('<a href="' + Continuation.nextUrl() + '">click here</a>');
    Continuation.nextPage();
    res.write("you said: " + foo);
  }

This action displays three pages: the first renders a form, the second a link, and the third will show a message containing the string entered in the first page.

An area that still needs work is serialization support, as continuations currently will not work in conjunction with persistent sessions. Persistent HopObjects shouldn't be included in a serialized continuation, so we need to convert Nodes into NodeHandles in the output stream, and convert back to Nodes in the input stream. The latter currently fails in session restore because it requires a Transactor thread. For global references we need to make sure they're excluded from serialization. Helma 1.7 seems like a good timeframe to fix these issues.

=== Jetty Continuations

Jetty continuations are a mechanism to keep HTTP connections pending without having a Java thread associated with the request.

http://docs.codehaus.org/display/JETTY/Continuations

This is not a "real" continuation as this isn't supported by Java. Instead, it relies on "that all actions taken by a filter or servlet before a call to suspend(long) are either idempotent (can be retried) or are made conditional on isPending() so they are not performed on retried requests".

http://jetty.mortbay.com/apidocs/org/mortbay/util/ajax/Continuation.html

Jetty continuations are a means to allow AJAX polling without a thread penalty.

     removed
     added