我目前正在阅读《GWT in Action 第二版》一书及其示例代码。在第 5 章关于 ClientBundle
使用的讨论中,他们提供了示例代码,其中有一个扩展 com.google.gwt.rpc.client.RpcService
的接口(interface)。当我将此示例项目加载到 Eclipse IDE 中时,代码显示红色,因为包 com.google.gwt.rpc
不存在。这很可能是因为我使用的是 GWT 2.7,而这本书是用 GWT 2.5 写的。我试图查看 JavaDoc 以了解它何时被删除,以及它的替代品应该是什么,但唯一的 JavaDoc 是最新的,并且从网站下载 2.5 会返回未找到页面 (404) 错误。我的 IDE 建议我将请求的接口(interface)更改为 com.google.gwt.user.client.rpc.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
的正确替换接口(interface)是什么,也许还告诉我它在哪个版本中被删除?
最佳答案
com.google.gwt.rpc
是一项实验,旨在替换 com.google.gwt.user
中的 RPC。它没有达到预期,最终在 2.7 中被删除。所以,是的,使用 RemoteService
,就像您实际上应该一直做的那样。
关于java - 在GWT中,2.5接口(interface)RpcService是否被RemoteService接口(interface)取代?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39859661/