Is it feasible to create a REST client with Flex?

前端 未结 15 1974
无人共我
无人共我 2020-11-29 23:05

I\'m starting a project using a Restful architecture implemented in Java (using the new JAX-RS standard)

We are planning to develop the GUI with a Flex application.

相关标签:
15条回答
  • 2020-11-29 23:55

    As many have pointed out HTTPService is a bit simplistic and doesn't do all that you want to do. However, HTTPService is just sugar on top of the flash.net.* classes like URLLoader, URLRequest and URLRequestHeader. Using these you can assemble most HTTP requests.

    When it comes to support for other methods than GET and POST the problem mostly lies in that some browsers (for example Safari) don't support these, and Flash Player relies on the browser for all it's networking.

    0 讨论(0)
  • 2020-11-29 23:56

    REST is more of an ideology than anything. You go to the REST presentations and they have coolaide dispensers.

    For Flex apps, rolling a stack in conjunction to BlazeDS and AMF data marshalling is more convenient and more performant.

    0 讨论(0)
  • 2020-11-29 23:58

    Flex support for REST is weak at best. I spent a lot of time building a prototype so I know most of the issues. As mentioned previously , out of the box there is only support for GET and POST. At first glance it appears that you can use the proxy config in LiveCycle Data Services or Blaze to get support for PUT and DELETE. However, its a sham. The request coming from your Flex app will still be a POST. The proxy converts it to PUT or DELETE on the server side to trick your server side code. There are other issues as well. It's heard to believe that this is the best that Adobe could come up with. After my evaluation we decided to go in another direction.

    0 讨论(0)
  • 2020-11-29 23:59

    Yes, I was able to use POST and access headers with this component:

    http://code.google.com/p/as3httpclient/wiki/Links

    Example

    0 讨论(0)
  • 2020-11-30 00:00

    The short answer is yes, you can do RESTful with Flex. You just have to work around the limitations of the Flash player (better with latest versions) and the containing browser's HTTP stack limitations.

    We've been doing RESTful client development in Flex for more than a year after solving the basic HTTP request header and lack of PUT and DELETE via the rails-esque ?_method= approach. Tacky perhaps, but it gets the job done.

    I noted some of the headers pain in an old blog post at http://verveguy.blogspot.com/2008/07/truth-about-flex-httpservice.html

    0 讨论(0)
  • 2020-11-30 00:00

    The book Flexible Rails may be helpful -- It is an excellent resource on how to use Flex as a RESTful client. Although it focuses on using Flex with the Rails framework, I believe the concepts apply to any RESTful framework. I used this book to get up to speed quickly on using Flex with REST.

    0 讨论(0)
提交回复
热议问题