You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de> on 2002/06/28 23:45:37 UTC

Flowscript + Actions

Ovidiu,

I managed to hack support for actions, InputModules, and OutputModules
into flowscript. With that one can

  var y = inputValue("request", "a");
  var x = act("request", "", {"parameters":"true", "default.dest":"invalid.html"});
  outputSet("attribute", "dest", x.dest);
  outputSet("attribute", "a", x.a);
  outputCommit("attribute");

(This is not yet in CVS)

However, on two issues I need advice:

a) actions return a java.util.Map. I managed to convert it to a
org.mozilla.javascript.NativeObject -- but I have no idea how to make
it printable / enumerate all values. OTOH should it be done at all?
It's nice to do a.foo or a['foo'] instead of a.get('foo') but it 
requires to copy the complete map.

b) actions require a redirector object. Some actions use it to redirect
to another URL -- how should that be taken into account in respect with
flowscript? Make it another property of the returned map? Test for it
and sendPage()? Ignore it?

Cheers,

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


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


Re: Flowscript + Actions

Posted by Ovidiu Predescu <ov...@apache.org>.
Hi Christian,

On 6/28/02 2:45 PM, "Christian Haul" <ha...@dvs1.informatik.tu-darmstadt.de>
wrote:

> Ovidiu,
> 
> I managed to hack support for actions, InputModules, and OutputModules
> into flowscript. With that one can
> 
> var y = inputValue("request", "a");
> var x = act("request", "", {"parameters":"true",
> "default.dest":"invalid.html"});
> outputSet("attribute", "dest", x.dest);
> outputSet("attribute", "a", x.a);
> outputCommit("attribute");
> 
> (This is not yet in CVS)

This is great!

> However, on two issues I need advice:
> 
> a) actions return a java.util.Map. I managed to convert it to a
> org.mozilla.javascript.NativeObject -- but I have no idea how to make
> it printable / enumerate all values. OTOH should it be done at all?
> It's nice to do a.foo or a['foo'] instead of a.get('foo') but it
> requires to copy the complete map.

To enumerate the values I think you need to implement the getAllIds() method
from the Scriptable interface.

Also, I don't think you need to copy the complete map. You can create a
wrapper object around the Map object. This can be done by having the wrapper
class implement the Scriptable interface.

> b) actions require a redirector object. Some actions use it to redirect
> to another URL -- how should that be taken into account in respect with
> flowscript? Make it another property of the returned map? Test for it
> and sendPage()? Ignore it?

I think redirecting to a different URL might pose problems, especially if
that URL makes a reentrant call back to the flow engine. I would personally
ignore the Redirector object.

Regards,
Ovidiu

PS: Again, I'm leaving tomorrow morning, and I won't be reading emails for
the next 10 days or so.

-- 
Ovidiu Predescu <ov...@apache.org>
http://radio.weblogs.com/0109407/ (Radio Weblog)
http://www.geocities.com/SiliconValley/Monitor/7464/ (Apache, GNU, Emacs...)



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