GWT RPC Proxy - how to create custom own one

Skip to first unread message

Олександр Бежан

Jul 31, 2012, 9:48:31 AM7/31/12
AFAIK GWT generates RPC proxies using Generators. I need more control in my proxy and so want to create my custom proxy. How can I do that ?

Colin Alworth

Jul 31, 2012, 11:54:20 AM7/31/12
All of the source for the existing RPC proxy generation code can be found in gwt-user.jar. As with all Generators, the first step is to create a Generator or GeneratorExt subclass, and reference it in the module (this is in RemoteService.gwt.xml):
    <generate-with class="">
        <when-type-assignable class=""/>

You'll need to be sure that your redefinition of this rule superceeds GWT's built in rule. This can most easily be done by placing it after any other <inherits> rule in your module.

ServiceInterfaceProxyGenerator is a pretty short class, doing some sanity checking, then passing off to the ProxyCreator class. You can extend ServiceInterfaceProxyGenerator to override createProxyCreator to make your own ProxyCreator subclass.

ProxyCreator does most of the heavy lifting - figuring out what types can go over the wire, asking for FieldSerializers for each type, and eventually building the proxy itself. This is where the bulk of your modifications will probably take place.
Reply all
Reply to author
0 new messages