中止 RemoteObject 调用
是否可以中止 Flex RemoteObject 调用?我尝试了以下方法,但 http 请求仍在后台加载:
var r:RemoteObject = new RemoteObject('<myDestination>');
r.source('myClass');
r.myMethod.addEventListener(ResultEvent.RESULT, myResponse);
r.myMethod(); // lets say this method takes 5 second to call
r.channelSet.disconnectAll(); // I thought this would abort the actual HTTP request but its still running
编辑
我感兴趣的是释放浏览器 HTTP 管道,就像在 javascript 中一样,您可以在其中使用 abort XHR。
Is it possible to abort a flex remoteObject call? I tried the below method but the http request is still loading in the background:
var r:RemoteObject = new RemoteObject('<myDestination>');
r.source('myClass');
r.myMethod.addEventListener(ResultEvent.RESULT, myResponse);
r.myMethod(); // lets say this method takes 5 second to call
r.channelSet.disconnectAll(); // I thought this would abort the actual HTTP request but its still running
EDIT
The thing I'm interested in is freeing up the browsers HTTP Pipeline, just like in javascript where you can use abort on the XHR.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试 抽象操作。
更新:
您应该在服务器端服务中进行另一个操作来停止当前服务。然后,当您需要中止当前正在运行的服务时,取消操作(在 Flex 上),然后通过从 Flex 端调用 stop 服务来调用停止服务。
停止服务器端当前正在运行的线程,取决于您使用的服务器端。
you can try
cancel()
method of AbstractOperation.UPDATE:
you should make another operation in your server side service to stop current service. then when you need to abort the current running service, cancel the operation (on flex) then call the stop service by calling stop service from flex side.
to stop current running thread on server side, depends on what server side you used.
请注意,取消操作只会影响 Flex 客户端 - 您的响应程序永远不会被调用。在服务器端,请求正常运行(直到最后消耗资源),您必须编写一些自定义代码以防止这种情况发生。
Note that by Operation cancel it will only influence the Flex client - your responders are never going to be invoked. On the server side there the request is running normally (consuming resources until the end), and you'll have to write some custom code in order to prevent that.