Search code examples
gwtrequestfactory

What gets send to the server with request factory


I have problem to understand what does Request factory send to server. I have a method

Request<NodeProxy> persist(NodeProxy node)

NodeProxy is an Object from tree like structure (has child nodes and one parent node, all of type NodeProxy). I'v change only one attribute in the node and called persists.

The question now is what gets send to the server? In the dock here https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory there is:
"On the client side, RequestFactory keeps track of objects that have been modified and sends only changes to the server, which results in very lightweight network payloads."

In the same dock, in the chapter Entity Relationships, there is also this:
"RequestFactory automatically sends the whole object graph in a single request."

And I'm wondering how should I understand this.

My problem: My tree structure can get quete big, lets say 50 nodes. The problem is that for update of one attribute the method

public IEntity find(Class<? extends IEntity> clazz, String id)

in the class

public class BaseEntityLocator extends Locator<IEntity, String>

gets called for each object in the graph which is not acceptable.

Thank you in advance.


Solution

  • The problem you're facing is that RequestFactory automatically edit()s proxies when getting properties, and there's a bug when constructing the request payload that makes the whole graph of proxies to be implicitly edited that way, even if you didn't call the getter yourself.
    That bug has many repercussions, including false-positives in RequestContext's isChanged(): http://code.google.com/p/google-web-toolkit/issues/detail?id=5952

    I have great hopes that this will be fixed in GWT 2.5 (due in the next weeks).