Background:

OpenSocial containers provide the method gadget.io.makeRequest because
gadget scripts aren't able to use XHR due to the SOP.  Furthermore, I
believe, OpenSocial containers don't expose the _IG_GetCachedUrl(url)
method that the gwt-gadgets library uses.

Now, regarding the gwt-gadgets library, to be blunt, it simply scares
me.  I don't want all the gadget stuff brought into the Java
programming language with interfaces and annotations.  Having the
bootsrap and gadget.xml generated with a custom linker is scary and
unnecessary.  This is just asking for trouble with a leaky
abstraction.

The RPC Problem:

It's very easy to write a Google Gadget with GWT without using the gwt-
gadgets library.  Simply write your gadget.xml by hand (there's not
much to it, really), write your GWT app the traditional way, compile
it with the XS linker, and write a script tag referencing
your .nocache.js script in your gadget.xml.  You can call all the
OpenSocial and Gadgets API methods from your GWT code using JSNI (JSO
overlay types could simplify things a bit).

The only problem is RPC.  Currently using GWT-RPC in an OpenSocial
container seems impossible.   You'd have to write a JSON service.

The Proposed Solution:

This is just a rough sketch, but I think this can be accomplished as
follows:

1) Subclass RequestBuilder to use gadgets.io.makeRequest

2) Subclass RemoteServiceProxy and override the protected method
doPrepareRequestBuilder to return an instance of your custom
RequestBuilder subclass.

3) Modify ProxyCreator to allow setting a custom superclass for the
generated proxy class.  I.e. allow chaning this line:
composerFactory.setSuperclass(RemoteServiceProxy.class.getSimpleName
());

(Perhaps with a system property defining the class name for starters).
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to