Friday, April 27, 2012

Request Context clear queue on method invocations when onConstraintViolation is called

To perform save  in a view I am using RequestFactoryEditorDriver to flush any changes to a RequestContext and then I call 

save(the edited proxy).to(MyReceiver<Void>).fire();

MemberRequest s = (MemberRequest)editorDriver.flush();
MemberProxy sectorProxy = (MemberProxy)getProxy();
s.saveMember(sectorProxy).to(new MyReceiver<Void>()).fire();

MyReceiver has a onConstraintViolation method which displays violations generated in the server. I am using my own  ServiceLayerDecorator.validate() to check for any business-related constraints.

To this point it works fine. However when after more than one attempts the user "fixes" all violations and the entity reaches the service, the save method is invoked multiple times (as many attempts it took to pass validation). I understand that  this is because the request context is queuing all method invocations and by calling onConstraintViolation. this queue is not cleared and this leads to multiple calls to the server.

My question is how/where to clear the request context of any method invocations that have lead to the call of onConstraintViolation 

thanks in Advance
Alex

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/-xRnHK7QqzEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment