简体   繁体   中英

Is it possible to use the GWT RPC-oriented Command Pattern without the use of RPC serialization?

In the process of refactoring the client-serverside communication of out GWT-based framework I came across discussions concerning the possible elimination of RPC in GWT 3.0+

Our framework is currently based on the RPC-oriented Command Pattern . At the moment I'm wondering on how it would be possible to get rid of RPC without changing the business code fundamentally.

My first approach was to use JSON for serialization/deserialization of Action and Result. But at least on client side methods fromJsonString() and toJsonString() need to be implemented manually because there is no reflection on client side. After reading about JSInterop which was introduced with GWT 2.7 I wondered if there maybe is a better way to serialize/deserialize the Action and Result on clientside as well as on serverside.

Unfortunately I'm a bit stuck right now. Are there already approaches to implement the command pattern without RPC?

Best regards

I wouldn't worry to much about possible elimination of RPC at this moment (2016). Given the current speed of the GWT releases it might take some time before we see version 3 and even then the elimination of RPC is not a sure thing. So from a priority point of view there is no reason to put much effort in it.

A past RPC future would very likely be based on JSON. Where the json code is generated from the Java classes. There are some libraries to do this. For example look at gwtjsonrpc . It uses the json-rpc (as the name already suggest). You could use it as a command pattern, but it's not a direct implementation of the command pattern.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM