cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject [Flow] Possible fix for passing objects from flow to view
Date Wed, 08 Jan 2003 20:51:27 GMT
The current flow code has a problem when passing Java object from the 
flow to the view using the sendPage and sendPageAndWait functions: all 
the values in the map that is passed as the second argument to the 
function get converted to strings. This makes it impossible to access 
field values using JXPath, as described in the documentation.

I've come up with the following fix. It does not break any of the 
examples and I've tested that Java objects are correctly passed. 
However, it was more or less a wild guess and I'd like the fix to be 
reviewed by Ovidiu or someone more knowledgeable than me about the 
internals of Rhino and the flow.

Here's the diff,

	Ugo


Index: JSCocoon.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/JSCocoon.java,v
retrieving revision 1.10
diff -u -r1.10 JSCocoon.java
--- JSCocoon.java       5 Dec 2002 09:37:20 -0000       1.10
+++ JSCocoon.java       8 Jan 2003 20:21:13 -0000
@@ -271,7 +271,8 @@
        if (value == Undefined.instance)
          value = null;
        else
-        value = ScriptRuntime.toPrimitive(value);
+        // value = ScriptRuntime.toPrimitive(value);
+        value = jsobjectToObject(value);
        hash.put(key, value);
      }
      return hash;


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message