GWT Data Serialization

后端 未结 2 1819
深忆病人
深忆病人 2021-01-16 04:18

I\'m looking for the algorithm that Google\'s Web Toolkit uses to serialize data posted to the server during an AJAX request. I\'m looking to duplicate it in another languag

相关标签:
2条回答
  • 2021-01-16 05:07

    I've written a design document explaining the GWT-RPC wire format. Hopefully you'll find it useful.

    0 讨论(0)
  • 2021-01-16 05:09

    The GWT-RPC serialization is heavily tied to Java. It even sends Java class names over the wire.

    I suggest you use something like JSON to communicate with the server. This way, you can use any programming language with the GWT server.


    Update: There are no definitive references to the GWT-RPC format, and a mailing list post explains that decision:

    The GWT RPC format is intentionally opaque JSON. This makes it somewhere between difficult and impossible to add a non-GWT agent to the RPC discussion. There isn't really a nice work-around for creating a non-Java server-side implementation but, because your RemoteServiceServlet implementation just has to implement your synchronous RPC interface, it's quite possible for non-GWT clients to talk to the same server-side business logic, just without using the RPC protocol.

    and the little detail which surfaced was

    The wire format is plain text. It's actually JSON. It's just unreadable JSON because the assumption is that both the producing and consuming code is auto-generated and can make all kinds of assumptions about the structure of the text.

    0 讨论(0)
提交回复
热议问题