在REST中处理同步请求 [英] handling sync requests in REST

查看:59
本文介绍了在REST中处理同步请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在处理一个任务,以处理客户端和服务器之间的同步,客户端与REST端点进行通信.在以下情况下出现问题,

客户端有一个大对象(例如10 MB)要与服务器同步,因此我必须序列化该对象,然后将其拆分为两个(例如5 MB).所以现在我可以将第一部分发送为帖子,然后发送第二部分,但是我的问题是,由于这两个部分只是两个单独的REST请求,因此无法在服务器上进行组合.如果有人可以提供解决方法的线索,我将不胜感激.或真的有可能吗?

预先感谢.:)

Hi ,

I''m working on a task to handle synchronization between the client and server,client communicates with a REST endpoint . I got a problem in the following scenario ,

client has a large object(e.g. say 10 MB) to sync with server, so I have to serialize the object and then break it into two (e.g say 5 MB). so now i can send the first part as a post and then the second part, but my problem is since these two parts are just two separate requests for REST, they cannot be combined at the server. I really appreciate if anyone can give a clue how to handle this. OR really is this possible ?

thanks in advance .:)

推荐答案

我认为处理此问题的方法是将对象分成几个较小的部分.在每个部分中,为对象提供一个项目号(与对象的每个部分相同),一个零件号(唯一)和一个总零件数(公共).

收到零件后,将其存放在接收器上,直到所有零件都收到为止.一旦收到最后一个,就重新组装以重新构造原始对象.
I think the way to handle this is to split the object into several smaller parts. In each part, give the object an item number (common to each part of the object) a part number (unique) and a total parts (common).

On the receiver as the parts are received, store them until all the parts are received. Once the last one has been received re-assemble to re-construct the original object.


使您的REST服务异步,并在客户端异步调用它并实现回调函数.
对您有用的链接.
http://msdn.microsoft.com/en-us/library/ms731177.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/ms730059.aspx [ ^ ]
Make your REST service asynchronous, and at client call it asynchronously and implement a call back function.
Helpful links for you.
http://msdn.microsoft.com/en-us/library/ms731177.aspx[^]

http://msdn.microsoft.com/en-us/library/ms730059.aspx[^]


这篇关于在REST中处理同步请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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