2016-10-04 48 views
0

我正在阅读本书GWT in Action 2nd Edition及其示例代码。在关于ClientBundle的讨论中,在第5章中,他们有示例代码,其中有一个接口延伸到com.google.gwt.rpc.client.RpcService。当我将这个示例项目加载到Eclipse IDE中时,代码显示为红色,因为包com.google.gwt.rpc不存在。这很可能是因为我正在使用GWT 2.7并且该书被写回到GWT 2.5中。我试图查看JavaDoc以查看它何时被删除,以及它的替换应该是什么,但唯一的JavaDoc是最新的,并且从网站2.5下载返回没有页面找到(404)错误。我的IDE建议我将请求的界面更改为com.google.gwt.user.client.rpc.RemoteService,但不知道这是否是正确的替代品,似乎有点奇怪。在GWT中是否将2.5接口的RpcService替换为RemoteService接口?

他们提供的代码示例如下:

package com.manning.gwtia.ch05.client.cssresource; 

import java.util.HashMap; 
import java.util.List; 

import com.google.gwt.rpc.client.RpcService; 
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; 
@RemoteServiceRelativePath("CSSResourceService") 
public interface ResourceService extends RpcService { 
    List<String> getThemes(); 
    HashMap<String, String> getTheme(String name); 
} 

有谁知道适当的更换接口RpcService,也许还告诉我在哪个版本它被删除?

回答

3

com.google.gwt.rpc实验旨在从com.google.gwt.user替换RPC。它没有达到预期,最终在2.7版中被删除。所以是的,使用RemoteService,就像你实际上应该做的一样。

+0

谢谢,这本书没有解释他们为什么使用这个界面,当然它已经足够老掉了这些信息。 – JRSofty