GWT how can I reduce the size of code serializers for RPC calls

前端 未结 5 645
谎友^
谎友^ 2021-01-02 11:21

I found that the more than 60% of the javaScript code generated by GWT on my application is for RPC serializers. Also I found that serializers are not shared between service

5条回答
  •  不知归路
    2021-01-02 11:53

    For any GWT-RPC Service, GWt will generate one Proxy, one TypeSerializer. And for each object which possibly can be passed via GWT you will have one FieldSerializer class. And there can be only one FieldSerializer per class. So there is no way you can have two FieldSerializers for one AccountDTO.

    Deferred binding rule which you trying to use will not work. For example you have something like this: MyServiceAsync sync = GWT.create(MyService.class);

    Deferred binding rules will change it into:

    MyServiceAsync sync = new MyServiceAsync_Proxy();

    Your rules will actually do something like this:

    MyServiceAsync sync = new MyGenericService() ;//not valid since MyGenericService is an interface

    So your solution will not work.

    Since you are saying that 60% of you application generated code is RPC related stuff, I suspect you have RPC type explosion problem.

    Check if GWT doesn't throws any warnings during compilation, or generate stubs for RPC TypeSerializers, most likely you've some very common interface in service.

提交回复
热议问题