1
GWT in Action,2ed(MEAP),218页表示我们可以在客户端代码中引用注释中的服务器端类,如@ProxyFor。这是符合逻辑的,什么我希望......从GWT编译但我得到异常:GWT RequestFactory:在客户端程序包中使用服务器类
Validating newly compiled units
[ant:java] Errors in 'file:/C:/git/mvp_ap_test/src/de/mycompany/client/AppRequestFactory.java'
[ant:java] Line 9: The import de.mycompany.server.AnnotatedRfqServiceLocator cannot be resolved
[ant:java] Line 10: The import de.mycompany.server.dao.AnnotatedRfqService cannot be resolved
[ant:java] Line 15: AnnotatedRfqService cannot be resolved to a type
[ant:java] Line 15: AnnotatedRfqServiceLocator cannot be resolved to a type
[ant:java] Line 15: Class<AnnotatedRfqServiceLocator> cannot be resolved to a type
[ant:java] Errors in 'file:/C:/git/mvp_ap_test/src/de/mycompany/client/proxy/AnnotatedRfqProxy.java'
[ant:java] Line 9: The import de.mycompany.server.AnnotatedRfqServiceLocator cannot be resolved
[ant:java] Line 10: The import de.mycompany.server.domain.AnnotatedRfq cannot be resolved
[ant:java] Line 12: AnnotatedRfq cannot be resolved to a type
[ant:java] Line 12: AnnotatedRfqServiceLocator cannot be resolved to a type
[ant:java] Line 12: Class<AnnotatedRfqServiceLocator> cannot be resolved to a type
[ant:java] Errors in 'file:/C:/git/mvp_ap_test/src/de/mycompany/client/proxy/AnnotationProxy.java'
[ant:java] Line 6: The import de.mycompany.server.domain.Annotation cannot be resolved
[ant:java] Line 8: Annotation cannot be resolved to a type
[ant:java] Removing invalidated units
我不引用任何服务器端类,除了在注释:
package de.mycompany.client;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.RequestFactory;
import com.google.web.bindery.requestfactory.shared.Service;
import de.mycompany.client.proxy.AnnotatedRfqProxy;
import de.mycompany.server.AnnotatedRfqServiceLocator;
import de.mycompany.server.dao.AnnotatedRfqService;
public interface AppRequestFactory extends RequestFactory {
AnnotatedRfqRequest annotatedRfqRequest();
@Service(value = AnnotatedRfqService.class, locator = AnnotatedRfqServiceLocator.class)
public interface AnnotatedRfqRequest extends RequestContext {
Request<AnnotatedRfqProxy> findOne(String id);
}
}