Hi,
I had to do something like that a couple years ago, but with GraniteDS.
Basically I had to send the locale of the user to the server so any error
messages they might receive from the server would be in the correct language.
I was able to add a new property to the token’s message.headers object. On the
server side I was able to get the granite context and access the header with my
property on it. We ended up storing it as an attribute on the session, but you
can do what you like.
Client side where login occurs
public function doLogin(user:String, pwd:String, locale:String,
channelSet:ChannelSet = null):void{
var token:AsyncToken = null;
token = RemoteObject(service).channelSet.login(user,pwd);
// Adding locale to headers so the server
// can access the user's locale.
// Adding the locale to the CommandMessage's headers map.
token.message.headers[“com.foo.locale”] = locale;
token.addResponder(responder);
}
Server side where login occurs
@Override
public void login(Object credentials, String charset) throws
SecurityServiceException {
HttpGraniteContext graniteContext =
(HttpGraniteContext)GraniteContext.getCurrentInstance();
String locale =
(String)graniteContext.getAMFContext().getRequest().getHeader(LOCALE_HEADER);
}
Keegan Sands
Technical Lead
T: +1-603-570-4633
www.loftware.com<http://www.loftware.com/>
From: Ronny Shibley [mailto:[email protected]]
Sent: Friday, April 03, 2015 8:29 AM
To: [email protected]
Subject: Flex BlazeDS RemoteObject HttpHeader
Dear Flex Users.
I am trying to pass parameters to RemoteObject service calls. Basically I need
to pass the app version, username, userid... without having to modify all my
existing functions...
I want be able to retrieve those in a servlet filter.
Anyone done this before ?
Kind Regards,
Ronny Shibley, Eng
Software Architect | Codefish | www.codefish.com<http://www.codefish.com>
t +961 5 450824<tel:%2B961%205%20450824> | m +961 70
250650<tel:%2B961%2070%20250650>
[cid:[email protected]]<https://goo.gl/maps/UcEGK>