[UPDATE Jan 19th, 2008]
I’ve just modified RESTProxy.php to handle gzip encoding from the client-side. It was quite simple. I was trying to consume web services on Discogs.com and it requires that you accept gzip encoding.. The source has been modified.
Mise en situtation
for those who have been following the development of the AS3 Youtube Data API library development, you might have seen that I hit a serious wall when I tried doing PUT and DELETE requests using
flash.net.URLRequest together with
flash.net.URLLoader. Simply put, it is impossible to execute such requests directly from the code library provided in Flash CS3. Some people have been trying to get around the problem using raw sockets, but will hit another wall inevitably: you are only allowed to connect raw sockets to the host that served you the .swf file. Hence, impossible to connect to
I had another idea, using Flex’s HTTPService inside of code compiled using Flash CS3. Hit another wall there. You can dynamically load some of Flex’s classes, like StringUtil, for example, using a Loader + the applicationDomain to get a reference to the Classes embedded in a SWF then instantiating them; but it doesn’t work on my complex Flex classes. You get weird errors, which I don’t understand. After spending a day on that, I decided it was over.
My goal was to keep this library client-side, AS3 only. I didn’t mind loading a SWF to get some of it’s classes, but I didn’t want to use a proxy on a server… and well, it can’t be done.
In comes the proxy
The idea is to provide a very general, generic proxy to help AS3 become RESTful. I had a few ideas, and in the end decided to opt for AMFPHP because of my past experience with it, and the fact that since Patrick Mineault (who has been a friend here in Montreal) has left, it seems it doesn’t get much attention. AMFPHP now talks AMF3, which I think is pretty cool.
Continue reading Getting around AS3’s un-RESTful-ness