You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Simone Gianni (JIRA)" <ji...@apache.org> on 2006/04/03 02:17:01 UTC

[jira] Commented: (COCOON-1819) No support for creation of Bookmarks from JavaFlow

    [ http://issues.apache.org/jira/browse/COCOON-1819?page=comments#action_12372872 ] 

Simone Gianni commented on COCOON-1819:
---------------------------------------

This was not an easy task. I first started trying to emulate what flowscript does :
- Add a method in AbstractContinuable
- From there get the continuation
- Create a new continuation
- Set the new continuation as the current one
- Modify the JavaInterpreter a bit to get the current continuation after invoking the method since it could be changed.

But unfortunately it was not so easy, i ended up with a certain number of stack exception since the ContinuationClassLoader was rewriting that method too, and managing continuation from a method that has been rewritten to work with continuations was not correct.

Afterall, making a bookmark is nothing more than calling the next continuation, so this is a good workaround :

  // I want a bookmark here 
  sendPageAndWait(mycontinuationid + ".cont");

(Obviously this means that there is a *.conf going to the continuations, it's a hack but it's a workaround).

But, after testing this was true, maybe the problem could be solved this way :
- The method createWebContinuation in AbstractContinuable should set a flag.
- The interpreter checks that flag
- If the flag is set calls the handleContinuation on the new continuation directly.

Again it's not so easy, since due to class loader issues it's not possible to call a AbstractContinuable.getFlag() from the JavaInterpeter (if not with reflection). So I unfortunately had to push these methods (actually getState and resetState) up to Continuable, which seems to be the the only join point between JavaInterpreter and AbstractContinuable.

This, unfortunately, changed Continuable from a marker only interface to an interface with two methods, thus breaking code compatibility with other implementations of Continuable (BTW, AbstractContinuable is the only implementation in cocoon, and implementing it directly is quite an uncommon practice).

BUT, it works.

I also added the code to invalidate the continuation, which is quite handy to avoid "the infamous back button" and subseguent resubmissions.

Other possible solutions would be :
1) Placing the code to create a new continuation somewhere else accessible from AbstractContinuable.
2) Keep this code but call the getState and resetState thru reflection, so that Continuable is not affected, but having an impact on performance and code readability.


> No support for creation of Bookmarks from JavaFlow
> --------------------------------------------------
>
>          Key: COCOON-1819
>          URL: http://issues.apache.org/jira/browse/COCOON-1819
>      Project: Cocoon
>         Type: Improvement

>   Components: Blocks: Java Flow
>     Reporter: Harlan Iverson

>
> There is no JavaFlow equivalent of createWebContinuation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira