I just finished reading Thijs van der Vossen’s article, Flex can’t do REST, and I figured I’d weigh in a with a few of my experiences given that I’ve been doing quite a bit of playing with Ruby on Rails, Actionscript 3, the Adobe Flex framework and Adobe Air (previously Apollo).
First and foremost, Thijs is correct and Harris Reynolds must either have a hidden agenda or is kidding himself. Perhaps both!
The issue they’re both talking about lies outside the realm of Flex classes, and right down at the Flash Player level. Brian Riggs’ article that was linked to by Thijs, Making HTTP calls in ActionScript 3, refers to the problematic class as being “AS3’s
HTTPService class”, which might have thrown people onto the wrong trail. The issue is with
flash.net.URLLoader (Flash), not
So what is this “issue”? It’s all in the response headers, actually. While you can get access to the response codes by listening to the
HttpStatusEvent.HTTP_STATUS event when using
URLLoader, it’s not going to help you with getting access to response headers. I’d put money on the fact that Adobe is unwilling to provide access to the headers because the functionality is not available in all browsers. Their opinion — as a guess — is that the Flash plugin should operate in an identical fashion across all browsers.
Sucks to be us.
The “proof” of all this can be seen when you take a look at the Air API docs for the HTTPStatusEvent class. There’s a
responseHeaders property which spits out an array of
URLRequestHeader objects…exactly what we want.
Perhaps someone from Adobe could give us a run-down of whether this the product of internal policies regarding Flash plugin behaviour across browsers?