在 ActionScript 3 中模拟服务器响应
我有一个用 ActionScript 3 制作的客户端应用程序。还有一个用 Java 制作的服务器。服务器将以 JSON 格式发送响应,但尚未完成。因此,我需要以某种方式在某个文件中模拟来自服务器的硬编码响应。获取某些密钥的响应。
例如:
request: http://www.serverscript.com/GET_INFO?a=2&e="hello"
response: {some JSON object}
在iPhone中,我们有可以使用的pList文件。
我可以在这里使用什么以及如何使用?
I have a client app made in ActionScript 3. And a server on Java. The server will send responses in JSON format, but it is not already done. So, I need to emulate somehow, hardcoded responses from server in some file. To get the responses for some key.
For example:
request: http://www.serverscript.com/GET_INFO?a=2&e="hello"
response: {some JSON object}
In the iPhone, we have the pList files that we can use.
What can I use here and how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
简单的解决方案:在计算机上运行服务器:
http://www.apachefriends.org/en/xampp .html
这样你就不必模拟任何东西。您可以将服务器端代码和客户端代码放在同一台计算机上,完成后无需在任何地方进行重构,只需上传即可完成。您可以编写一个快速的 php 脚本来输出静态 json 对象,这将在完成时模拟与您的 java 服务的连接。
Easy solution: Run a server on your computer:
http://www.apachefriends.org/en/xampp.html
That way you don't have to simulate anything. You can have your server side code and your client side code on the same machine, no refactoring required anywhere when you're done just upload and you're done. You can write a quick php script to output a static json object and this will simulate connecting with your java service when it's completed.
您可以从包含虚拟 JSON 的纯文本文件加载:
You can load in from a plain text file containing your dummy JSON:
您确实希望将与服务器之间的通信包装在自己的类中,这样您就可以在准备就绪时将服务器代码重构到其中,例如
You really want to wrap communication to and from the server in its own class, that way you can refactor the server code into it when its ready e.g.