Custom Proxy Class

The GWTP annotation-based automatic proxies will work in almost every situations, but in very rare cases you may have specific needs that are not currently supported by annotations. In these cases, it might be useful to code your own custom Proxy class.

Before you start implementing your own custom proxy, you should try to use the @ProxyEvent annotation to solve your problem. This annotation is described in more details here.

Before we start, here is a useful trick. If you want to see the proxy classes generated by GWTP, use the GWT compiler -gen extras flag when compiling your application. All the generated proxy classes will then be found under the extras folder.

Note

This page is a work-in-progress. Meanwhile, don't hesitate to ask questions on the forum.

How to setup your Presenter

To setup your presenter...

Custom standard Proxy

To do a standard proxy...

Custom Proxy that is also a Place

The following example shows you how to build a basic custom proxy that is also a place. This example uses code splitting, if you don't want this replace AsyncProvider with Provider and CodeSplitProvider with StandardProvider.

public class MyPresenterProxyPlaceImpl extends ProxyPlace<MyPresenter>
implements MyPresenter.MyProxy {

    public static class WrappedProxy extends ProxyImpl<MyPresenter> {
        @Inject
        public WrappedProxy( AsyncProvider<MyPresenter> presenter ) {
            this.presenter = new CodeSplitProvider<MyPresenter>(presenter);
        }
    }

    @Inject
    public MainPagePresenterMyProxyImpl( WrappedProxy proxy ) {
        this.proxy = proxy;
        place = new PlaceImpl( "myToken" );
    }
}