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

查看:25
本文介绍了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.

浮出水面的小细节是

有线格式为纯文本.它实际上是 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天全站免登陆