Friday, July 29, 2011

Re: Re-firing a failed/rejected server call in RequestFactory, is this possible?

Hmm, I tried going down the onViolation / onFailure paths, but ran in to other problems with those.

For onFailure, is there a way to send a valueProxy back inside the exception payload?  It looks like the default behavior is just to extract the message out of any thrown exception.  I'd like to return my errors to the client in a meaningful format so I can mark up the editor.  I guess worst case I could serialize the object array as a string and decode it on the client, but I'd like to avoid that if possible.

onConstraintViolation is what I really wanted, but couldn't find any hooks on the server side to allow me to convert my legacy application's server-side violations into the necessary ViolationMessages.  Basically I'd like to run the code from the SimpleRequestProcessor:process(request,response) function:
    // Validate entities
    List<ViolationMessage> errorMessages = validateEntities(source);

    if (!errorMessages.isEmpty()) {
      resp.setViolations(errorMessages);
      return;
    }

but rather than get the errors from the validateEntries method, my service layer method invocation will either return or throw them.  Unfortunately it doesn't look like the SimpleRequestProcessor is override-able since it's declared private final in the RequestFactoryServlet, and I couldn't find any hooks to allow me to post-process the response after the invocation.

Thanks,
Eric

--
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/-/ZvpcOJlgnpoJ.
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