GWT RequestFactory 是否支持扩展 RequestContext 的接口?
我的许多服务都只是暴露在 DAO 中。因此,我为这些服务创建了一个接口:
public interface DAORequestContext<T extends SRSProxyBase> extends RequestContext {
Request<T> find(Long id);
Request<T> load(Long id);
Request<T> save(T id);
}
但是,当扩展此接口时(在我的 RequestFactory 中没有注释):
public interface SafeRideRequestFactory extends RequestFactory {
public UserService userService();
@Service(value = UserDAO.class, locator = DAOServiceLocator.class)
interface UserService extends DAORequestContext<SRSUserProxy> { }
}
我收到运行时异常:
[ERROR] org.saferide.shared.service.DAORequestContext has no mapping to a domain type (e.g. @ProxyFor or @Service)
[ERROR] The type org.saferide.shared.service.DAORequestContext must be annotated with a @Service or @ServiceName annotation
[ERROR] The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
[ERROR] Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
仅允许 RequestContext 的直接后代吗?有人遇到过这个吗?
Many of my services are just exposed DAO's. So I created an interface for these services:
public interface DAORequestContext<T extends SRSProxyBase> extends RequestContext {
Request<T> find(Long id);
Request<T> load(Long id);
Request<T> save(T id);
}
However when extend this interface (without annotations in my RequestFactory):
public interface SafeRideRequestFactory extends RequestFactory {
public UserService userService();
@Service(value = UserDAO.class, locator = DAOServiceLocator.class)
interface UserService extends DAORequestContext<SRSUserProxy> { }
}
I get runtime exceptions:
[ERROR] org.saferide.shared.service.DAORequestContext has no mapping to a domain type (e.g. @ProxyFor or @Service)
[ERROR] The type org.saferide.shared.service.DAORequestContext must be annotated with a @Service or @ServiceName annotation
[ERROR] The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
[ERROR] Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
Are only direct descendants of RequestContext allowed? Has anybody run into this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅 http://code.google.com/p/ google-web-toolkit/issues/detail?id=5807 及相关http://code.google.com/p/google-web-toolkit/issues/detail?id=6234 和 http://code.google.com/p/google-web-toolkit/issues/detail?id=6035
这确实取决于关于您正在使用的 GWT 版本,它仍在改进中。您最好在发布时使用 GWT 2.4(此外,“验证”将在编译时而不是运行时完成)
See http://code.google.com/p/google-web-toolkit/issues/detail?id=5807 and related http://code.google.com/p/google-web-toolkit/issues/detail?id=6234 and http://code.google.com/p/google-web-toolkit/issues/detail?id=6035
It really depends on the version of GWT you're using and it's still being improved. You'd better use GWT 2.4 when it's released (where, in addition, that "validation" will be done at compile-time rather than runtime)