ovidiu 02/03/29 21:30:04 Modified: src/scratchpad/schecoon/src/org/apache/cocoon/components/flow JavaScriptInterpreter.java Log: Implement forwardTo(). Revision Changes Path 1.11 +31 -0 xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/JavaScriptInterpreter.java Index: JavaScriptInterpreter.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/JavaScriptInterpreter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JavaScriptInterpreter.java 25 Mar 2002 07:33:54 -0000 1.10 +++ JavaScriptInterpreter.java 30 Mar 2002 05:30:04 -0000 1.11 @@ -14,7 +14,9 @@ import org.apache.cocoon.components.treeprocessor.InvokeContext; import org.apache.cocoon.components.treeprocessor.MapStackResolver; import org.apache.cocoon.components.treeprocessor.ProcessingNode; +import org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode; import org.apache.cocoon.environment.Environment; +import org.apache.cocoon.environment.ForwardRedirector; import org.apache.cocoon.environment.Source; import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; @@ -25,6 +27,12 @@ import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.tools.shell.Global; +/** + * Interface with the JavaScript interpreter. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a> + * @since March 25, 2002 + */ public class JavaScriptInterpreter extends AbstractInterpreter implements Initializable { @@ -251,6 +259,29 @@ environment.removeAttribute("kont"); if (pipelineArgs != null) ctx.popMap(); + } + } + + public void forwardTo(String uri, Object bizData, + WebContinuation continuation, + Environment environment, InvokeContext ctx) + throws Exception + { + if (ctx == null) { + String msg = "Cannot invoke pipeline with a null InvokeContext! Make sure" + + " you're calling the pipeline during the execution of a request."; + throw new RuntimeException(msg); + } + + environment.setAttribute("bean-dict", bizData); + environment.setAttribute("kont", continuation); + + try { + PipelinesNode.getRedirector(environment).redirect(false, uri); + } + finally { + environment.removeAttribute("bean-dict"); + environment.removeAttribute("kont"); } } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]