You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 8 Members of 4089 |
| Forum: Seam Users |
16. Aug 2008, 01:52 CET | Link |
Hi! I have to admit am a little shocked (and disappointed) with the limitations imposed by Seam Remoting (I was trying to port from DWR in to Seam Remoting, but I think I found a showstopper):
As there is no native support for Maps within Javascript, a simple Map implementation is provided with the Seam Remoting framework. To create a Map which can be used as a parameter to a remote call, create a new Seam.Remoting.Map object:var map = new Seam.Remoting.Map();
Why is that needed? I mean, in DWR, to achieve the same effect (send a datastructure) from JavaScript in to a Java service, all I have to do is:
var object = new Object();
If I need to send, for example, name
and age
all I have to do is:
var person = new Object(); person.name = "John Smith"; person.age = 16;
Compare that with what seam requires:
var person = new Seam.Remoting.Map();
person.put("name","John Smith");
person.put("age",16);
IMHO having to use Seam.Remoting.Map is unnecessarily intrusive...
What do I have to do to customize Seam Remoting to support this?
In DWR, I can set a converter:
For a bean:
<dwr:convert class="somePackage.SomeClass" type="bean"/>
For a map:
<dwr:convert class="java.util.Map" type="map"/>
What is the equivalent mechanism for Seam Remoting?
3 Replies: | |||
|---|---|---|---|
The goal of Seam Remoting is to provide a JavaScript interface that's (as much as possible) API-compatible with its Java counterpart. However having said that, there's no reason why it couldn't support using an associative array for Map values. Any Map values returned by a remote method would still however be an instance of Seam.Remoting.Map, however it wouldn't be hard to add a toObject() convenience method that would return the Map as an associate array. If this sounds like it would address your concerns, then please raise a feature request in JIRA. |
|||
Hi! Shane Bryzak wrote on Aug 16, 2008 02:04: I like the idea of the toObject() in Seam.Remoting.Map, but I think Seam Remoting should also offer:
Thanks Regards,
P.S. Should I create 3 JIRA entries, one for each of the 3 I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death. |
|||
Created them: JBSEAM-3280, JBSEAM-3281, JBSEAM-3282 I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death. |
I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.