Someone also pointed out to me that we have the flash.system.Capabilities.language value which provides some benefit if not the whole header.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jfournet
Sent: Friday, October 13, 2006 12:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cannot get Accept-Language from HTTP header with httpService

 

I am trying to get the Accept-Language header by calling the
following jsp with a flex httpService to get the locale of the
client's browser for i18n purposes. When I execute the jsp
standalone the Accept-Language header is there, but when I execute it
by calling it with an httpService there is no Accept-Language
header. Can anyone tell me why this is so and direct me to a method
to get the browser's prefered locale?

getlocale.jsp

<%

String s = request.getHeader("Accept-Language");

out.println(s.substring(0,2) + "_" + s.substring(3,5));

%>

Flex Application:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="initApp();">
<mx:Script>
<![CDATA[
import flash.external.ExternalInterface;
import mx.rpc.events.ResultEvent;
public var clientLocale:String = new String();
[Bindable]
public var localeSWF:String;
import mx.controls.Alert;

private function initApp():void
{
getClientLocale.send();
}
public function setLocale
(event:ResultEvent):void
{

//Alert.show(String
(getClientLocale.lastResult));
localeSWF = "helloworld_" + String
(getClientLocale.lastResult) + ".swf";

}

]]>
</mx:Script>
<mx:HTTPService id="getClientLocale" useProxy="false"
resultFormat="text" result="setLocale(event)" showBusyCursor="true"
method="POST"
url="">jsp">
</mx:HTTPService>
<mx:SWFLoader id="myLoader" width="300"
source="{localeSWF}"/>
</mx:Application>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to