Thursday, August 18, 2016

Re: Best Practice for JSON object recreation on client

Hi,

I am using resty-gwt. Resty-gwt had his own (forked from jackson I believe) json serialization classes. But now Rest-gwt is switching to gwt-jackson. I haven't managed to get gwt-jackson to work with my setup (yet) but looks like a valid path forward.

In the server I am using CXF and the normal jackson. I am not saying everything is perfect but most of my objects are transferred without a fuss. In some cases where the object is complicated (e.g. Collection<Map<T, Collection<V>> members or inheritance) I have to provide a custom provider that knows how to deal. However this was a one time pain for me. Now I have forgotten all the terrifying details and it just works.

I am sure there are other solutions like GSON which I don't have any experience with.

Furthermore with the upcoming GWT3 which will deprecate generators all these projects have a scheduled rewrite pending... So who knows?

    Vassilis



On Thu, Aug 18, 2016 at 10:33 AM, Max Fromberger <max.fromberger@gmail.com> wrote:
Hello everybody,

First of all a big THANKS to everyone involved in developing and supporting GWT.

please correct me wherever I am wrong:

In the past you used JsonUtils.safeEval() to create a JavaScriptObject from a JSON String. As i understand it, jsinterop annotations on classes not extending JavaScriptObject are now preferred over JavaScriptObjects.

What is the recommended, future-proof way of having a server-client common class (i.e. package "shared") that can be:

- created and accessed in a JVM servlet
- created and accessed from the client end
- serialized to JSON / deserialized from JSON to the specific class on the server (e.g. using GSON)
- serialized to JSON / deserialized from JSON to the specific class on the client

Background: Using WebSocket Servers to bidirectionally transfer JSONified objects. No GWT-RPC involved.
Trying to avoid duplicate environment specific classes, boilerplate code etc.

Thanks for every clue and please overlook me not having a native English interface. ;)



kind regards,
max


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment