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="getlocale.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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/