简体   繁体   English

如何从Windows小工具进行GWT RPC调用?

[英]How do I make a GWT RPC call from a Windows gadget?

I created a Windows desktop gadget using GWT RPC but how could I make a remote call? 我使用GWT RPC创建了Windows桌面小工具,但是如何进行远程调用? The gadget may only run client part of code (javascript). 该小工具可能仅运行代码(javascript)的客户端部分。

First you should deploy your application to some server. 首先,您应该将应用程序部署到某些服务器上。

Consider your remote service url is: http://server.com/myapp/myrpcservice You should target your service to that URL instead of using @RemoteServiceRelativePath: 考虑您的远程服务URL是: http ://server.com/myapp/myrpcservice您应该将服务定位到该URL,而不是使用@RemoteServiceRelativePath:

ServiceDefTarget target = (ServiceDefTarget) myRPCService;
target.setServiceEntryPoint("http://server.com/myapp/myrpcservice");
myRPCService.call(...);

Now you can use this client as Windows gadget. 现在,您可以将此客户端用作Windows小工具。

Please note, that this code will not work in browser or in GWT Development Mode. 请注意,该代码在浏览器或GWT开发模式下将不起作用。 That's because of the Same Origin Policy. 那是因为有相同的原产地政策。

This code will only work with Windows gadgets, because the Same Origin Policy is disabled for gadgets. 该代码仅适用于Windows小工具,因为小工具已禁用“相同来源策略”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM