处理 GWT RequestFactory 服务器错误响应
我有一个新编码的 GWT/GAE 应用程序,它在客户端上使用 RequestFactory 和编辑器,并在背面使用自定义 Objectify DAO 服务。
成功后,flush() 然后 persist() 路径可以正常工作。 客户端 JSR 303 也可以正常工作。
我的问题是如何触发服务器警告/错误并处理 UI 更新?
我正在使用 Chandler 的 Generic DAO for Objectify 2 http://turbomanage.wordpress.com/2010/02/09/generic -dao-for-objectify-2/
我的 gwt 活动正在调用 persist( myProxy ).fire( new Receiver<> )
我的 dao 代码针对业务逻辑情况抛出 IllegalArgumentException 和其他 RuntimeException,例如“发现重复的电子邮件地址” - 想登录吗?”
Receiver<>.onSuccess() 可以很好地跟踪成功的结果。 Receiver<>.onFailure() 和 Receiver<>.onViolation() 均不会报告 RuntimeExceptions。
(更正:针对服务器端异常调用 onFailure())
有更好的方法吗? DAO 应该抛出哪些异常以使 onViolation() 或 onFailure() 报告错误? 编辑者应该如何处理异常并从中恢复?
I have a newly coded GWT/GAE app that uses RequestFactory and Editors on the client and a custom Objectify DAO Service on the back.
The flush() then persist() paths work fine on success.
Client side JSR 303 works as well as can be expected too.
My question is how to trigger server warnings/errors and handle UI updates?
I am using Chandler's Generic DAO for Objectify 2 at
http://turbomanage.wordpress.com/2010/02/09/generic-dao-for-objectify-2/
my gwt activity is calling persist( myProxy ).fire( new Receiver<> )
my dao code is throwing IllegalArgumentException and other RuntimeExceptions for business logic situations like "Duplicate email address found - want to login instead?"
Receiver<>.onSuccess() works fine to track a successful outcome.
neither Receiver<>.onFailure() nor Receiver<>.onViolation() report the RuntimeExceptions.
( Correction: onFailure() is being called for server-side exceptions)
Is there a better way to do this?
What exceptions should the DAO throw such that onViolation() or onFailure() report errors?
How should the editor(s) handle and recover from the exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现最通用的命令序列是
基于下面的对话摘录 http://groups.google.com/group/google-web-toolkit/browse_thread/thread/da863606b3893132/96956661c53e1064?hl=en
I've found the most versatile command sequence to be
Based on the conversation excerpt below at http://groups.google.com/group/google-web-toolkit/browse_thread/thread/da863606b3893132/96956661c53e1064?hl=en