Are interfaces that extend RequestContext supported with GWT RequestFactory?
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 validati开发者_如何学JAVAon
[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?
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)
精彩评论