GWT数据序列化 [英] GWT Data Serialization

查看:127
本文介绍了GWT数据序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Google的Web Toolkit用于在AJAX请求期间序列化发布到服务器的数据的算法。我希望以另一种语言复制它,这样我就可以将我的另一个项目与GWT项目联系在一起。

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 language so that I can tie in another of my projects with a GWT project.

任何帮助都非常感谢!

推荐答案

GWT-RPC序列化与Java密切相关。它甚至通过线路发送Java类名。

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

我建议你使用类似JSON的东西与服务器进行通信。这样,您可以在GWT服务器上使用任何编程语言。

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

更新:有没有对GWT-RPC格式的明确引用,并且邮件列表发布解释了这个决定:

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


GWT RPC格式是故意不透明的JSON。这使得它
之间的困难和不可能将非GWT代理添加到
RPC讨论中。对于
来说,创建非Java服务器端实现并不是一个很好的解决方法,但是,因为您的
RemoteServiceServlet实现只需实现您的
同步RPC接口,所以很可能对于非GWT客户端而言,
与同一个服务器端业务逻辑交谈,而不使用
RPC协议。

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


格式是纯文本格式。它实际上是JSON。这只是
不可读的JSON,因为假设是生产函数和
消费代码都是自动生成的,并且可以对文本的结构做出各种假设

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.

这篇关于GWT数据序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆