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

前端 未结 5 628
谎友^
谎友^ 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 12:15

    If you want to have a nicer solution, why not use a command pattern. that way you only need one GWT service that accepts a Command subtype and returns a Result subtype (you can make it typesafe by using generics).

    The nice thing is that you only need to declare one method in one gwt servlet and from there on you can dispatch to any other server side service.

    The command pattern can give you a lot of added benefit as well since you have a central point of control to do security checks or allows you to transparently batch requests

    You exposure to GWT thus becomes much smaller on the server side.

提交回复
热议问题