struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: content-language header with Struts2 does not uses the invocation locale
Date Wed, 10 Oct 2012 16:34:55 GMT
As a work-around, you could implement ServletResponseAware and call
setHeader() on the injected HttpServletResponse to set the proper locale
value.  But I agree that Struts should take the value for the header from
it's defined location.
  (*Chris*)

On Wed, Oct 10, 2012 at 9:20 AM, JOSE L MARTINEZ-AVIAL <jlmagc@gmail.com>wrote:

> Hi all,
>  I'm using Struts 2.2.3. I've setup a property "struts.locale" with value
> "es_ES", for Spanish. But my application is multilanguage, so I setup the
> locale in the request using an interceptor:
>
> public String intercept(ActionInvocation invocation) throws Exception {
> [...]
> <get locale for the user>
> [...]
> invocation.getInvocationContext().setLocale(userLocale);
> return invocation.invoke();
> }
>
>
> The action and the JSPs(I'm using Tiles),correctly use the locale I set(so
> the response has the body in the correct language), but the header
> content-language is returning always "es_ES", no matter the locale I put in
> the invocationcontext.
>
> Any ideas on how can I get the correct locale in the header? a Meta tag in
> the page is not an option, since I have the same problem even with
> JSONResults.
>
> Thanks
>
> JL
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message