try this:

in the flex sdk, in file 
\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as change 
the code as shown in my gist[1] starting at line 182:


to use this, here is a class that I constructed from the air app that i 
mentioned, which utilizes the now patched cookie functionality.


I had to develop this functionality to allow me to correctly use HTTPService 
for CakePHP's cookie based authentication system.  This allowed me to actually 
"login" to my server, and then use that cookie for each subsequent call, 
essentially creating a web session in my AIR app.  CakePHP typically uses all 
GET based REST and maps most data via routing.  Of course you can POST data 
too, but having custom headers and COOKIES via GET was a MUST for my 
application.  So I started hacking away at it, and eventually found a way to 
make it work.  The only catch was that I had to change the rpc package of the 
flex sdk.


hope that this is useful to someone!


[1] https://gist.github.com/davidcoleman007/4717928


Cheers!
-Dave



> From: dnai...@emarketinginc.com
> To: dev@flex.apache.org
> Date: Tue, 5 Feb 2013 14:16:54 -0700
> Subject: RE: HTTPService Response Headers
> 
> Thanks Rick,
> 
> I am in the process of developing API to integrate with the .NET RESTful 
> servicing and there are two things I am would like to do.
> 1) On all GET and POST calls to RESTful endpoints attached an 
> "authentication" header with two name value pairs, i.e. a key and token.
> 2) I want to be able to handle a 400 Bad Request error (and other 400 errors) 
> and parse through a JSON payload to allow Flex to determine how to proceed. 
> In the past we have forced a 200 status with a JSON payload but would like to 
> if possible handle 400 errors...
> 
> Dan
> 
> -----Original Message-----
> From: Rick Winscot [mailto:rick.wins...@gmail.com] 
> Sent: Tuesday, February 05, 2013 10:58 AM
> To: dev@flex.apache.org
> Subject: Re: HTTPService Response Headers
> 
> Dan.
> 
> If you are not using a proxy service like BlazeDS... anything other than an 
> HTTP200 is going to cause your Flex application fits. If you are looking for 
> the notion of a 'successful failure' where an operation completed (e.g. a 
> partial save) but had errors. You'll need to implement the semantics of that 
> condition yourself - Flex is relegated to either a result or fault.
> 
> If you've considered pushing elements into HTTP headers... remember that 
> custom HTTP request headers are only supported for POST requests, not for GET 
> requests. 
> 
> http://verveguy.blogspot.com/2008/07/truth-about-flex-httpservice.html
> 
> Additionally, heavy restrictions have been placed on HTTP headers in Flash 
> Player 9.0+ and may get worse. So... your mileage will depend on which 
> headers you want to touch.
> 
> http://helpx.adobe.com/flash-player/kb/authorization-header-request-flash-player.html
> 
> If you have a concrete use-case, we might be able to hammer out an approach 
> that works reliably. What exactly did you have in mind?
> 
> Cheers,
> 
> Rick Winscot
> 
> 
> 
> On Tuesday, February 5, 2013 at 12:22 PM, Dan Nailor wrote:
> 
> > Hello,
> > I am looking to find out if there is anything in the works to allow the 
> > HTTPService response headers to be interrogated beyond successful and 
> > unsuccessful calls? From what I understand this is not possible with the 
> > current class and may be a limitation of some browsers.
> > 
> > http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/
> > rpc/http/HTTPService.html 
> > http://blogs.adobe.com/kiwi/2006/07/making_http_calls_in_actionscr.htm
> > l (Response Headers)
> > 
> > Thanks!
> > 
> > Dan
> > 
> > This transmission may contain information that is privileged, confidential, 
> > and/or exempt from disclosure under applicable law. If you are not the 
> > intended recipient, you are hereby notified that any disclosure, copying, 
> > distribution, or use of the information contained herein (including any 
> > reliance thereon) is STRICTLY PROHIBITED. If you received this transmission 
> > in error, please immediately contact the sender and destroy the material in 
> > its entirety, whether in electronic or hard copy format. 
> 
                                          

Reply via email to