在 GWT 中,2.5 接口 RpcService 是否已被 RemoteService 接口取代?
In GWT is the 2.5 interface RpcService replaced by RemoteService interface?
我目前正在阅读 GWT in Action 第 2 版 一书及其示例代码。在关于 ClientBundle
用法的讨论的第 5 章中,他们有示例代码,其中有一个扩展 com.google.gwt.rpc.client.RpcService
的接口。当我将此示例项目加载到我的 Eclipse IDE 时,代码显示为红色,因为包 com.google.gwt.rpc
不存在。这很可能是因为我使用的是 GWT 2.7,而这本书是用 GWT 2.5 编写的。我试图查看 JavaDoc 以查看它何时被删除,以及它的替代品应该是什么,但唯一的 JavaDoc 是最新的,并且从网站下载 2.5 returns 找不到页面(404)错误。我的 IDE 建议我将请求的接口更改为 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
的正确替换界面是什么,也许还可以告诉我它是在哪个版本中删除的?
com.google.gwt.rpc
是一个 实验 ,旨在从 com.google.gwt.user
中替换 RPC。它没有达到预期,最终在 2.7 中被删除。所以是的,使用 RemoteService
,就像你实际上应该一直那样做。
我目前正在阅读 GWT in Action 第 2 版 一书及其示例代码。在关于 ClientBundle
用法的讨论的第 5 章中,他们有示例代码,其中有一个扩展 com.google.gwt.rpc.client.RpcService
的接口。当我将此示例项目加载到我的 Eclipse IDE 时,代码显示为红色,因为包 com.google.gwt.rpc
不存在。这很可能是因为我使用的是 GWT 2.7,而这本书是用 GWT 2.5 编写的。我试图查看 JavaDoc 以查看它何时被删除,以及它的替代品应该是什么,但唯一的 JavaDoc 是最新的,并且从网站下载 2.5 returns 找不到页面(404)错误。我的 IDE 建议我将请求的接口更改为 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
的正确替换界面是什么,也许还可以告诉我它是在哪个版本中删除的?
com.google.gwt.rpc
是一个 实验 ,旨在从 com.google.gwt.user
中替换 RPC。它没有达到预期,最终在 2.7 中被删除。所以是的,使用 RemoteService
,就像你实际上应该一直那样做。