将 json 对象从 iphone 发送到 java servlet 的时间太长
我们正在开发一个 iPhone 应用程序,它将用户所在位置的 json 字符串发送到部署在 Google 应用程序引擎上的 Web 应用程序 (JAVA)。我们使用 htpp 请求来发送这些字符串。我们的问题是字符串有时很大,这需要很长时间。还有其他方法吗?
We are developing an iphone app that sends json strings of locations user has been at to a web app (JAVA) that is deployed on google app engine. We use htpp requests to send these strings. Our problem is that the the strings are large sometimes and this takes too long time. Is there any other method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以压缩您的 JSON。这是 GAE 的一段代码:
这是解压缩方法:
You can compress your JSON. This is the piece of code for GAE:
This is the uncompress method:
如果您的系统正在发送位置集合,请尝试不要一次发送所有位置,而是将整个集合分成小块,您估计的大小不会花费太多时间。
另一个想法:如果您将发送作为后台进程进行,则主进程(如用户界面中)不应受到惩罚。
If your system is sending a collection of locations, try not sending them all at a time, but splitting the whole collection in small blocks, with a size that you estimate doesn't take too much time.
Another idea: if you do this sending as a background process, the main process (as in user interface) shouldn't be penalized.