-
1. Re: Plain JavaScript Objects, java.util.Maps and Remoting
shane.bryzak Aug 16, 2008 2:04 AM (in response to luxspes)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.
-
2. Re: Plain JavaScript Objects, java.util.Maps and Remoting
luxspes Aug 18, 2008 5:52 PM (in response to luxspes)Hi!
Shane Bryzak wrote on Aug 16, 2008 02:04:
The goal of Seam Remoting is to provide a JavaScript interface that's (as much as possible) API-compatible with its Java counterpart.
Mmmm, I think that is fine, it should be comfortable for Java coders, but not at the price of making it uncomfortable for JavaScript coders. It should strive to provide a use of Java services as transparent as possible for the JavaScript side. (The goal should be: Easy for Java coders in the java side, easy for JavaScript coders in the JavaScript side)
However having said that, there's no reason why it couldn't support using an associative array for Map values.
Exactly, and I think associative array should be the default way to deal with both Maps an POJOs (or at least it should provide a transparent way to deal with them)
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.
I like that idea, but it would be even better if something could be configured to deal with associative arrays transparently (perhaps a configuration option in components.xml?)
If this sounds like it would address your concerns, then please raise a feature request in JIRA.I like the idea of the toObject() in Seam.Remoting.Map, but I think Seam Remoting should also offer:
- A complementary method to go from an associative array into a Seam.Remoting.Map easily (perhaps as a parameter in the constructor of Seam.Remoting.Map?)
- An alternative to seam/remoting/interface.js (other url like seam/remoting/idiomatic_interface.js, perhaps enabled by a components.xml option) that transparently receives associative arrays and returns associative arrays when the @WebRemote returns (or has a parameter of type) java.util.Map or a POJO (like DWR does). This would be specially helful for porting ajax enable applations built with other remoting techmologies, but also to make it easier for those coders that prefer JavaScript to Java to feel comforable (and dot put objections) to the use of Seam Remoting vs other options to do ajax/remoting.
- Give us choice, expose an API to customize Seam Remoting, so that if for some reason this never makes it in to Seam trunk, at least it becomes real easy to create some sort of plug-in to do it.
Thanks
Regards,
P.S. Should I create 3 JIRA entries, one for each of the 3
extra things
I think Seam Remoting should offer? -
3. Re: Plain JavaScript Objects, java.util.Maps and Remoting
luxspes Aug 18, 2008 9:22 PM (in response to luxspes)Created them: JBSEAM-3280, JBSEAM-3281, JBSEAM-3282