How to set an HTTP header while using a Flex RemoteObject method

apache-flexblazedsflashhttp-headersremoteobject

I am running blazeds on the server side. I would like to filter http requests using an http header. My goal is to send extra parameters to the server without changing the signatures of my blazeds services.

On the client side, I am using Flex RemoteObject methods.

With Flex WebService components, it is possible to set an http header using the property httpHeaders. I have not found anything similar on the RemoteObject class…

Best Answer

I couldnt modify http request from flex, instead I can add custom headers to the mx.messaging.messages.IMessage that RemoteObject sends to the server and there, extending flex.messaging.services.remoting.adapters.JavaAdapter (used for accessing Spring beans), it's posible to read the header parameters and put them into the HTTPRequest.

In the flex part, I had to extend mx.rpc.AsyncRequest: declares a new property "header" and overwrites invoke method that checks if there is a not null value for set the msg.headers.

and mx.rpc.remoting.mxml.RemoteObject: the constructor creates a new instance of our custom AsyncRequest and overwrite old AsyncRequest and it defines a setHeaders method that set the argument to the custom AsyncRequest.

com.asfusion.mate.actions.builders.RemoteObjectInvoker (extra :P): this one reads the param declared in the Mate's map RemoteObjectInvoker and puts in the RemoteObject header.

I hope it will be understandable (with my apache english xDDD)

Bye. Agur!