Domanda

I created a Windows desktop gadget using GWT RPC but how could I make a remote call? The gadget may only run client part of code (javascript).

È stato utile?

Soluzione

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:

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

Now you can use this client as Windows gadget.

Please note, that this code will not work in browser or in GWT Development Mode. 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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top