Tuesday, July 31, 2012

Re: GWT RPC Proxy - how to create custom own one

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="com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator">
        <when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
    </generate-with>

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.

On Tuesday, July 31, 2012 8:48:31 AM UTC-5, Олександр Бежан wrote:
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 ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/5XOVgK1mwTcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment