On Saturday, December 11, 2010 2:01:28 PM UTC-8, zixzigma wrote:
is it possible to use 2.1.1 RequestFactory/AutoBean to convert POJO to
JSON and viceversa
when interacting with a RESTful Web Service ?
the common practice with GWT client-server communication is
to have packages:
client, shared, server, configuring web.xml
however, in-order to be truly loosely coupled,
I am thinking of developing the Server side of my app,
as a REST WebService. completely separate from the client.
sending JSON encoded data to the Server, and reading JSON.
only using a common .jar file on both containing Entity POJOs.
the problem on GWT client side is a clean way of Converting JSON to
POJO back and forth.
I was wondering if the new AutoBean/RequestFactory/EntityProxy can
help in the situation I described ?
Clean conversion of JSON is achieved with com.google.gwt.jsonp.client.JsonpRequestBuilder
Request factory is not necessary.
These guidelines describe the basics of working with JSON and overlay types (JavaScript objects wrapped with Java facade)
com.google.gwt.jsonp.client.JsonpRequestBuilder simplifies things even more because there is no need to do any JSNI and eval().
And it also allows for cross-site communication variant called JSON with padding, which is described in detail here:
Can i still use "Editor" if I opt for JSON/REST solution above ?
What do you think of this approach ? do you think it may result in
performance problems ?
Since overlay types look like POJOs, I think they should work with Editor framework, but I haven't tried that.