Getting http 500 response body with flex
I am using a HttpService
object in flex to communicate with the server.
I am using java in the server (tomcat), and once an exception occurs the fault event listener in the flex is called.
I am passing data on the exception in the response body in a xml form.
The thing 开发者_运维技巧is the flex fault event does not read the data from the response. How can i read the response body?
In my experience, you can't. Flex turns any 400-599 response codes into a generic IOError and only gives the status code. My understanding is that this is a browser-plugin limitation, but I'm not sure of the extent/reason.
The way we've gotten around it is that all 400-599's get wrapped as 200-OK with a response showing the details of the error. I've heard many argue that this means Flex/Flash can never truly be a RESTful client.
精彩评论