Flex HTTPService 超时处理程序
我的 Flex 应用程序在启动时发送一些并发请求。有时需要很长时间才能获取所有内容,因此我将它们的 requestTimeout
参数设置为 5 秒。此外,我还定义了一个处理故障事件的方法。我想在超时时重新发送请求。 但这不起作用。你能看一下代码吗?
protected function fatalErrorOccuredInfo(event:FaultEvent):void
{
// get the operation
var operation:mx.rpc.http.AbstractOperation = mx.rpc.http.AbstractOperation(event.target);
operation.url += "?t=" + new Date().getTime();
operation.useProxy = false;
//this should resend a request that caused timeout
operation.send();
}
我检查网络监视器中是否发送了新请求,但它没有显示任何内容:-(
任何帮助将不胜感激。
my flex application sends a few concurent requests on startup. Sometimes it takes a lot of time to fetch them all so I've set them requestTimeout
param to 5 secs. Additionally, I've defined a method that handles fault events. I'd like to resend a request when timeout occurs.
It doesn't work though. Could you take a look at the code?
protected function fatalErrorOccuredInfo(event:FaultEvent):void
{
// get the operation
var operation:mx.rpc.http.AbstractOperation = mx.rpc.http.AbstractOperation(event.target);
operation.url += "?t=" + new Date().getTime();
operation.useProxy = false;
//this should resend a request that caused timeout
operation.send();
}
I check whether a new request is sent in Network Monitor but it doesn't show anything :-(
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WebService 类有一个 < 一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/soap/mxml/WebService.html#getOperation%28%29" rel="nofollow">getOperation 函数返回 抽象操作。
将它与
event.currentTarget.name
一起使用所以这就像
我很不确定,但如果
operation.send()
没有到达结果事件,你可能会必须为ResultEvent.RESULT
添加事件监听器WebService class has a getOperation function which returns an AbstractOperation.
Use it with
event.currentTarget.name
So it would be something like
I am pretty not sure but if
operation.send()
does not get to the result event, you might have to add an event listener forResultEvent.RESULT
我看到的一个问题是这一行
每次发出请求时都会附加“?t =”+ new Date().getTime();
尽管这不应该是您的主要问题,但它确实是一个问题。
另外,如果您安装了 FireFox,请获取名为 HTTPfox 的附加组件。
HTTPfox 将向您显示从浏览器发出的所有请求
One problem I see is with this line
Every time you make a request you append "?t=" + new Date().getTime();
Although that shouldn't be your main issue it is a problem.
Also, If you have FireFox installed get an add-on called HTTPfox.
HTTPfox will show you all requests made from the browser