You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kurt Overberg <ku...@hotdogrecords.com> on 2005/03/19 00:07:44 UTC

Overriding the browser language setting?

Hi there all!  I'm trying to override the default struts/tomcat code that 
chooses an ApplicationResources.properties file based on the user's browser 
language setting.  I'd like to manage which language to serve up on my own (or 
based on an item in the user's session).  Does anyone have any pointers on how 
to do this?  Normally I would bash my head against an issue like this for weeks 
and weeks before finally posting, but in this case, its an emergency and time is 
short.  Thank you for any and all help any of you incredibly talented and 
intelligent people could provide.

/kurt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Overriding the browser language setting?

Posted by Jon Wingfield <jo...@mkodo.com>.
One solution would be to map a Filter to whichever URLs you wish to 
override the browser settings. In the Filter wrap the request, using a 
sub-class of javax.servlet.http.HttpServletRequestWrapper, before 
passing the request to the rest of the chain.
In your wrapper sub-class override the methods getLocale() and 
getLocales() and you should be set.

see:
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html

HTH,

Jon

Kurt Overberg wrote:
> 
> Hi there all!  I'm trying to override the default struts/tomcat code 
> that chooses an ApplicationResources.properties file based on the user's 
> browser language setting.  I'd like to manage which language to serve up 
> on my own (or based on an item in the user's session).  Does anyone have 
> any pointers on how to do this?  Normally I would bash my head against 
> an issue like this for weeks and weeks before finally posting, but in 
> this case, its an emergency and time is short.  Thank you for any and 
> all help any of you incredibly talented and intelligent people could 
> provide.
> 
> /kurt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org