BlazeDS VS REST +JSON
谁能告诉我:与使用为数据量相当大的 Flex 应用程序返回 JSON 数据的 Java REST Web 服务相比,BlazeDS 有哪些优点/缺点?
Can anyone tell me: What are the advantages/disadvantages of BlazeDS compared to using Java REST web services that return JSON data for a fairly data heavy flex application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BlazeDS 将使用 AMF 来编码数据,这比 JSON 更加紧凑。 AMF 是一种二进制格式,因此所有数字和日期值将明显小于 JSON。此外,AMF 在发送重复文本(类/属性名称)时使用字符串引用来节省大量空间。此外,每个 AMF 消息也仅发送一次引用类定义。
除了大小之外,AMF 的处理速度也比 JSON 快得多,尤其是在客户端,而且很可能在服务器端也是如此。
基本上,如果您可以选择使用 AMF 而不是 JSON,那就这么做吧。如果您必须使用仅支持 JSON 的现有服务,那么也没关系,但即使如此,如果它是大型应用程序或使用量很大,即使对于现有服务,您也最好切换到 AMF。
BlazeDS is going to use AMF for encoding data which is incredibly more compact than JSON. AMF is a binary format so all numeric and date values will be significantly smaller than with JSON. Also AMF uses string references to save a huge amount of space when sending repetitive text (class/property names). Additionally class definitions are also referenced only sent once per AMF message.
Besides the size, AMF is also significantly faster to process than JSON, definitely on the client side and most likely on the server side as well.
Basically, if you have a choice to use AMF over JSON, then do it. If you have to use an existing service that only supports JSON, then it's ok too, but even then if it's a large application or with significant usage, you're better off switching to AMF even for existing services.