On Friday, August 31, 2012 11:43:23 AM UTC+2, Manuel Schrag wrote:
>
> Hello,
>
> We're having a problem using the request factory in GWT 2.5 RC1. When
> calling *rejectBankCheck() *on the activity, it happens that there are
> bean validation errors. The service method corresponding to this request
> call is not invoked. By correcting the errors on the UI and clicking on a
> button, *rejectBankCheck()* is called again. This time, the receiver gets
> *onSuccess(). *Everything looks fine, but I can see that both,*onSuccess()
> * and the service method corresponding to *rejectBankCheck()*, are
> invoked twice!
>
> public void rejectBankCheck(String remarks) {
> request.rejectBankCheck(entity, remarks)
> .fire(new Receiver<ProtocolProxy>() {
>
> @Override
> public void onSuccess(ProtocolProxy response) {
> display.onRejectSuccess();
> }
> @Override
> public void onConstraintViolation(Set<ConstraintViolation<?>>
> violations) {
> display.setConstraintViolations(violations);
> }
> });
> }
>
> My first intention was to split this in two steps:
>
> 1. initialize the receiver when the activity starts
> 2. when the user clicks on the button, just call *fire()* on the
> request context
>
> This isn't possible, because the parameter *remarks *of the method is a
> user input and can change between the two invocations. So I have to call
> *request.rejectBankCheck(entity,
> remarks)* every time the user clicks.
>
> Here are my questions:
>
> 1. Is this a bug or a feature of the request factory? At the moment, I
> cannot see when this behaviour would be necessary or of any help.
>
>
Not a bug.
>
> 1. Can anyone see a workaround for this?
>
> Three:
- either don't use validation on the server-side (either do it on the
client-side before calling rejectBankCheck, or inside the rejectBankCheck
method on the server-side and use a new RequestContext in the onFailure
case)
- fire() once without the rejectBankCheck to validate the proxies, then
if OK create a new RequestContext, edit the proxies, call rejectBankCheck
and fire again
- move the remarks argument to a proxy so you can change it without the
need to call rejectBankCheck again
--
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/-/fbc0JLd9J4YJ.
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.