You have also some framework like piriti allowing easy mapping between JSON and Java object. But I don't like them because their overhead. I use another approach.
My model is made of interfaces. I share the interfaces between the server and GWT. For GWT, I have a generator that automatically implements the interface as a wrapper around the JSO. This wrapper is a zero-overhead implementation (just method forward). You can find my generator here if it can help you: http://code.google.com/p/tyco/source/browse/trunk/tyco-gwt/src/main/com/googlecode/tyco/gwt/tikray And you have some unittests here: http://code.google.com/p/tyco/source/browse/trunk/tyco-gwt/src/test/com/googlecode/tyco/gwt/tikray Olivier On 10 juin, 01:06, rhodebump <rhodeb...@gmail.com> wrote: > I did some reading up on RPC. Sounds like it would be perfect except > for the face that it is limited by the Same Origin Policy, so I can't > use it. > > I wish we could do an RPC with JsonpRequestBuilder > > Thanks for your insight, you have convinced me to do the Javascript > Overlays. I do like type safety and it sounds like it would be more > efficient. > > Phillip > > On Jun 9, 5:52 pm, Sripathi Krishnan <sripathi.krish...@gmail.com> > wrote: > > > I am assuming you have a strong reason not to use standard RPC - because if > > you really have POJO's on the server side, reusing the same objects on the > > client side should be a breeze. > > > It always makes sense to Javascript Overlays, otherwise you loose type > > safety and all the other advantages java has over javascript. It is a pain > > to maintain two versions for the same entity, but the advantages far > > outweigh the inconvenience. You can perhaps even build a small utility that > > generates the overlays -- shouldn't be too difficult. > > > And finally, if it eases your pain, most people end up having DTOs and Model > > objects *even if* they use regular RPC. That's because the POJO's you have > > on the server may be a complex hierarchy of objects; what you want on the > > client side is usually pretty simple and doesn't have deep hierarchies. > > > --Sri > > > On 10 June 2010 02:56, rhodebump <rhodeb...@gmail.com> wrote: > > > > I have several Java classes that I am using on the serverside, and I > > > am using these same classes to serialize the JSON stream back to my > > > GWT application. I am using the JsonpRequestBuilder to call my > > > service and it is successfully returning a JavascriptObject. > > > > What is the recommended approach to getting my objects from the json > > > response?, should it be a) coerce my JavaScriptObject into a string > > > and use the JsonParser, or b) write a 2nd implementation of my classes > > > using Javascript overlays? > > > > I don't really like either approach, one option means having 2 types > > > of objects that I would need to keep in sync (the pojo and the > > > Javascript overlay) and the other way means I have to traverse the > > > Json myself, populating my object glyph manually. > > > Either way, ouch. > > > > Thanks for listening, > > > Phillip > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google Web Toolkit" group. > > > To post to this group, send email to google-web-tool...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.