2xMax
2xMax

Reputation: 1752

flex URLLoader get Location header

I'm sending POST request using URLLoader and URLRequest with XML data. Then API sends response with redirect page(Location header) and i want to get this URL. How do I catch this response?

UPD:

Event.COMPLETE in debugger:

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"

Upvotes: 2

Views: 2420

Answers (1)

sangupta
sangupta

Reputation: 2406

Listen on the httpResponseStatus event of the URLLoader. The event details contains a property called responseHeaders that can provide you with location header. See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#event:httpResponseStatus for details.

Also, to prevent redirect you can set followRedirects on URLRequest to false. See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#followRedirects for details.

Upvotes: 1

Related Questions