使用GWT客户端调用Restlet web服务时出现问题
我使用的是Restlet框架,我想使用GWT作为客户端。我已经在Restlet中创建了一些ServerResources。以下是GWT客户端的代码: BookResourceProxy.java 公共接口BookResourceProxy扩展了ClientProxy { @得到 公共结果回调; } 使用此代理的类:使用GWT客户端调用Restlet web服务时出现问题,gwt,restlet,Gwt,Restlet,我使用的是Restlet框架,我想使用GWT作为客户端。我已经在Restlet中创建了一些ServerResources。以下是GWT客户端的代码: BookResourceProxy.java 公共接口BookResourceProxy扩展了ClientProxy { @得到 公共结果回调; } 使用此代理的类: BookResourceProxy wrp = GWT.create(BookResourceProxy.class); wrp.getClientResource().setRe
BookResourceProxy wrp = GWT.create(BookResourceProxy.class);
wrp.getClientResource().setReference("/Books");
wrp.getClientResource().getClientInfo().getAcceptedMediaTypes().add(new
Preference<MediaType>(MediaType.APPLICATION_JSON));
wrp.getBooks(new Result<String>()
{
public void onFailure(Throwable caught)
{
Window.alert("Fail" + caught.getMessage());
}
public void onSuccess(String json)
{
Window.alert(json);
}
});
运行应用程序时,我总是收到错误:
类型org.restlet.resource.ClientProxy没有可用的源代码;您是否忘记继承所需的模块
但是如果我在.gwt.xml中继承它:
出现另一个错误:
在类路径上找不到“org/restlet/restlet.gwt.xml”;可能是输入错误,也可能是您忘了为源代码包含类路径条目?
[错误]第13行:处理元素“继承”时出现意外异常
有人知道为什么吗
提前谢谢
Ike确保您正在使用,并且org.restlet.jar位于GWT编译器的类路径中。在GWT端,您必须使用包org.restlet.client.*,在GAE端,您使用org.reslet