views:

845

answers:

2

GWT RPC is a mechanism provided by gwt to communicate between client and server. Also there's a Request Builder, through which you can connect to the server.

Which mechanism would you recommend for a gwt based app, and please state the reasons to do so as well..

+3  A: 

Hi Satya, I'd think GWT RPC is most likely the way to go.

I might be wrong about this, but I believe the gwt RPC solution is built on top of RequestBuilder. It adds functionality on top of RequestBuilder such as automatic serialization of java classes and makes it pretty trivial to send data back and forth. Also, gwt RPC is probably the most popular solution at this time and so you'll find a lot more support in the form of tutorials and blog articles.

I tried "rolling my own" client/server mechanism using RequestBuilder, and it's doable, but in the end, gwt RPC already does everything I needed to implement in my custom solution so I decided to go back to it.

The only reason I could see needing to use RequestBuilder is if you need to do something outside the lines that doesn't work inside gwt RPC. For example, in one application, I needed to communicate using jsonp from my client code to a third party rest api that I didn't have control over. In this case, I wasn't able to use gwt rpc because I didn't have access to the server component.

Dave Paroulek
+1  A: 

GWT RPC is probably the way to go if your server is running Java.

If your GWT application needs to talk to a .NET, PHP, Python or other server you need to roll your own, using the RequestBuilder class. I would recommend using JSON as a way of representing the data.

Overlay types make parsing the JSON that comes back trivial.

Overlay objects can be serialized back to JSON with the following

   String json = new JSONObject(overlayInstance).toString();
AlexJReid