On Monday, April 4, 2011 3:41:59 PM UTC+2, KaffeineComa wrote: > > > Assuming "requestContext" above actually is a Request (not a >> RequestContext), that's abnormal. >> > >> If you're indeed talking about a RequestContext (and your T should be read >> as Void), then it's the normal behavior: the RequestContext-level Receiver's >> onFailure will only be called if the server (more or less) failed to >> deserialize the request or serialize the response. When processing service >> method invocations, each service method's Receiver's onFailure can be >> called, independently of the others, and the RequestContext-level Receiver's >> onSuccess will be called in the end. >> > > > Ah, well that's my problem then. In many cases I'm firing on the context > rather than on the request, because I have stacked up multiple calls, and I > want them to fire as a group, rather than having to fire them all serially. > There was a posting in this group a while back (hah, good luck finding it!) > suggesting that this was the right pattern to use for that kind of thing. > > The use case I have in mind is an editor for a complex page having several > text fields/drop-downs that are persisted to various tables in a DB. After > the user clicks "save", I wanted all the changes to be saved (or fail to > save, with error message) as a group. > > You'd have to attach a Receiver to each call (using the .to() method of the Request) and handle failures there. A RequestContext is not synonymous to a transaction (it's more like a "batching" mechanism), so each service method call can fail independently of the others. You can very well wrap them all in a single transaction on the server side, but you can't communicate a "global failure" (actually, you could, with a ServiceLayerDecorator overriding invoke() to die() instead of report()ing an InvocationTargetException)
-- 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.
