How do Cookies work in Flex?
Let's start with the goal. I need cookies to work as they do in any 'normal' browser.
I have a Flex application that will be calling a webservice(REST service at url http://www.abc.xyz/setcookie) and the service returns a response and a cookie. The service actually only records any cookies that it gets and returns another cookie along with a message of what it got in the cookie and what it set in the cookie. If I call this service in a browser (Mozilla) then the first time through there is no cookie but one is set and returned. The 2nd time calling with Mozilla I get the message that there is 1 cookie in the request and one is set and returned. All is well.
I code a flex application to simply call this service and try to decode the response. But am having problems.
1. Can't find the cookie in the ResultEvent. Look in the headers that are available (using Debug) but they don't seem to be there. Are they in the container? (Browser)?
2. When I make an HTTP Request using an HTTPService
<mx:HTTPService id="restServiceSetCookie"
url="http://localhost:8080/SimpleRESTapp/setcookie"
result="resultHandler(event)"
fault="faultHandler(event)"
/>
... and then call it multiple times, the server always records that 0 cookies were sent with this request. I would have expected that it would be 0 the first time and then it would be 1 the next time as the cookie that was set by the server the first time was returned. The result handler simple prints out the text message from the server saying how many cookies it got with the request and the cookie data.
Am I missing something fundamental in how Flex or the container (Browser) works with regard to cookies? Do you really have to reimplement cookie handling with every Flex application? I don't want to use Local Shared Objects as I would have to change the services that are being used presently. Any help or direction to look would be appreciated.
Thanks
Cam
