tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Schulte" <etlu...@googlemail.com>
Subject Fix for TAPESTRY-1202
Date Sat, 30 Jun 2007 17:53:19 GMT
I've hacked up a small fix for
https://issues.apache.org/jira/browse/TAPESTRY-1202 .
For non-browser-originating events, i.e. interception of regular methods,
any parameters
to the intercepted method are converted to strings and passed on to the
listener as service-parameters.
Thus, you can do things like this:

@EventListener(events="trigger", targets="clickRegions")
    public void onTriggered(BrowserEvent event, String firstArg, String
secondArg ){
        setTriggered( secondArg );
        getResponseBuilder().updateComponent("result");
    }

when you have " trigger.clickRegions=function( arg1, arg2) {...} " in your
client-side script.

The content of the browserevent-/targetnode-info stays exactly as it was.
However, to handle json properly, you'd have to
  1. pass the json-string to your javascript method being intercepted
  2. do "new JSONObject( firstArg )" manually in the listener to
de-serialize your object.

I think, in a lot of use-cases a plain string is enough - and converting it
to JSONObject is not a lot of overhead.
On the other hand I may have missed a "pre-designed" way to automatically
handle incoming JSON objects in a more elegant way...

Marcus

-- 
Marcus Schulte
http://marcus-schulte.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message