Friday, August 31, 2012

RequestFactory collects request calls after onConstraintViolation


I have the following method in my activity:

public void rejectBankCheck(String remarks) {
request.rejectBankCheck(entity, remarks)
.fire(new Receiver<ProtocolProxy>() {

public void onSuccess(ProtocolProxy response) {
public void onConstraintViolation(Set<ConstraintViolation<?>> violations) {

On the UI, the user enters remarks and clicks on a button. This invokes rejectBankCheck() on the activity. The current request is now fired with the associated receiver. It happens that there are constraint violations which the user then corrects and reclicks on the button. This time, the receiver gets onSuccess(), so everything seems to be correct. But I can now see that, in this case, onSuccess() and the corresponding service method of rejectBankCheck() are called twice. Or several times if the user doesn't correct the constraint violations after the first call. This means that the request calls are collected by the requestcontext.

My first intention was to split this into two steps:
  1. Initialize the requestcontext when the activity starts: request.rejectBankCheck(entity, remarks).to(new Receiver...
  2. Call when the user clicks on the button
This unfortunately isn't possible, since the parameter remarks (entered by the user) can change between two invocations.

Now my questions:
  1. Is this behaviour a bug or a feature of the request factory? I can't see where this would be useful. If it's a bug, I'll open an issue
  2. Can anyone see a workaround for this?

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment