flex URLLoader获取Location标头

时间:2010-10-06 09:44:49

标签: flex actionscript flex3 flex4

我正在使用URLLoader和URLRequest发送带有XML数据的POST请求。然后API使用重定向页面(位置标题)发送响应,我想获取此URL。我如何得到这种回应?

UPD:

调试器中的Event.COMPLETE:

event = flash.events.Event (@6e1edf9) 
 bubbles = false 
 cancelable = false 
 currentTarget = flash.net.URLLoader (@418e241) 
  [inherited] =  
  bytesLoaded = 1 
  bytesTotal = 0 
  data = " " 
  dataFormat = "text" 
  stream = flash.net.URLStream (@77c5fb9) 
   [inherited] =  
   bytesAvailable = 0 
   connected = true 
   endian = "bigEndian" 
   objectEncoding = 3 
 eventPhase = 2 
 target = flash.net.URLLoader (@418e241) 
  [inherited] =  
  bytesLoaded = 1 
  bytesTotal = 0 
  data = " " 
  dataFormat = "text" 
  stream = flash.net.URLStream (@77c5fb9) 
 type = "complete"

1 个答案:

答案 0 :(得分:1)

收听 URLLoader httpResponseStatus 事件。事件详细信息包含一个名为 responseHeaders 的属性,可以为您提供位置标头。有关详细信息,请参阅http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#event:httpResponseStatus

另外,为防止重定向,您可以将 URLRequest 上的 followRedirects 设置为 false 。有关详细信息,请参阅http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#followRedirects