What it means is that for a given RequestContext, you can now call more than
one method on it before fire()ing. This was not possible in GWT 2.1.0, where
only one invocation could be done.
For instance, if I want to create 10 objects in one go, assuming 'factory'
is a RequestFactory, Context is a RequestContext and DomainProxy is an
EntityProxy (or ValueProxy):
Context context = factory.context();
for (int i = 0; i < 10; i++) {
DomainProxy domain = context.create(DomainProxy.class);
domain.setIndex(i);
context.persist().using(domain).to(new Receiver<Boolean>() {
public void onSuccess(Boolean response) {
// this will be called for each domain object being persisted
// assuming the persist method returns a boolean here, but could be
whatever you want
}
});
}
context.fire(new Receiver<Void>() {
public void onSuccess(Void response) {
// this will be called once only for the whole "create 10 objects"
"batch" request
}
});
The to() is optional, as is the receiver in the final context.fire(). The
request is sent to the server only when calling a fire() method. Calling a
fire() on a Request or InstanceRequest is a short-hand to using .to() and
then immediately calling .fire() on the RequestContext.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.