如何确定HttpService实例是否超时?谢谢!
发布于 2009-08-25 17:58:55
如果你设置了requestTimeout,那么你的请求会在超时时抛出一个错误。因此,您只需将事件侦听器添加到httpservice faultevent。
发布于 2011-04-04 22:15:46
请注意HTTPService的这个迷人的限制……
如果您设置了http.requestTimeout方法,它将悄悄地忽略您要求它是POST请求的事实,并丢弃任何和所有标头。
由于某些原因,在Flex中,GET转储所有的头文件。
var http:HTTPService = new HTTPService()
http = new HTTPService();
http.method = "POST";
http.addEventListener(ResultEvent.RESULT, result*emphasized text*Handler);
http.addEventListener(FaultEvent.FAULT, resultHandler);
http.url = "http://www.example.com/post;
//http.requestTimeout = 5; //Watch out for this, there go the headers...
http.method = "POST";
http.send();哦,是的,设置method = " POST“两次是故意的,更有趣的是,如果你在调试器中运行它,当它运行到最后一行时,http.send(),当你查看对象的内部状态时,它仍然被设置为POST请求...
木偶。
发布于 2011-07-01 03:25:13
在Flex4.5(可能更早的版本)中,对于超时错误,在错误事件上有一个特定的错误代码:
在您的错误处理程序中:
if(faultEvent.fault.faultCode == "Client.Error.RequestTimeout"){
trace("TIMEOUT ERROR");
}https://stackoverflow.com/questions/1329878
复制相似问题