Wednesday 22 May 2013

GWT Request factory Vs RPC


What if your Server is not Java?
Server Side Code must be java. To communicate with different server, you have to use 
RequestBuilder class, JSNI methods or a third party library.  You will have to communicate using json/xml respone.

If your GWT application needs to communicate with a server, but you can't use Java servlets on the backend — or if you simply prefer not to use RPC — you can still perform HTTP requests manually. GWT contains a number of HTTP client classes that simplify making custom HTTP requests to your server and optionally processing a JSON- or XML-formatted response.

RPC

This feature did not work out as planned, and the GWT team strongly discourages its use.

Service Oriented.

Use it only for simple method call. Dont use it for heavy POJO transfer.

Manual Serailization of POJO need. 

RPC does  not keeps track of objects that have been modified and sends only changes to the server, which results in very heavy weight network payloads.

Do not use it to Transfer POJO.

 Request Factory

Recommended by GWT.

Efficient.

RequestFactory and its related interfaces (RequestContext and EntityProxy) make it easy to build data-oriented (CRUD) apps with an ORM-like interface on the client. It is designed to be used with an ORM layer like JDO or JPA on the server, although this is not required.

RequestFactory keeps track of objects that have been modified and sends only changes to the server, which results in very lightweight network payloads. In addition, RequestFactory provides a solid foundation for automatic batching and caching of requests in the future.

 Request Factory with Spring roo

Spring Roo auto generates this request factory related stuffs from domain . Means updating a domain, Spring roo auto updates request factory related stuff.

No comments:

Post a Comment