Wednesday, June 26, 2013

Re: RequestFactory validate entity

On Wednesday, June 26, 2013 4:09:55 PM UTC+2, Miklós Szabó wrote:

I've a question on bean validation using RequestFactory. Here's my scenario.

There's an application based on Spring Framework with a service layer. A WebApplicationContext is initialized and the services can be used by firing RequestContext on client side. Let's suppose I wanna save an entity. The context's save method get fired, a service method is invoked. The entity on the server side is valid. But in the service method another entity must be edited. That entity manipulation could raise ConstraintViolationException. When this happens, on the client side in the Receiver the onFailure method get called and I can't access that ConstraintViolation.
Is there a way/workaround to handle in the Receiver another entity's ConstraintViolation?
onConstraintViolation is only (should only be) about violations on the objects sent from the client, and block calls to service methods.
If a service method wants to communicate failure to the client, it has to return a failure code/object (onSuccess). You could use an ExceptionHandler too, but that's a hack: onFailure is about exceptional cases that should theoretically never happen (everything that can be predicted should go through onSuccess, even if it's communicating an error)

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment