Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9974DB09 for ; Sun, 27 Jan 2013 19:15:13 +0000 (UTC) Received: (qmail 98592 invoked by uid 500); 27 Jan 2013 19:15:13 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 98555 invoked by uid 500); 27 Jan 2013 19:15:13 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 98464 invoked by uid 99); 27 Jan 2013 19:15:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Jan 2013 19:15:13 +0000 Date: Sun, 27 Jan 2013 19:15:13 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (WW-3886) Content-Language in response does not uses the language setup in ActionContext MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-3886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13563887#comment-13563887 ] Lukasz Lenart edited comment on WW-3886 at 1/27/13 7:15 PM: ------------------------------------------------------------ But Dispatcher#prepare() method is called before interceptors and action is executed, it's better to do it like this: {code:java} public String intercept(ActionInvocation invocation) throws Exception { [...] [...] invocation.getInvocationContext().setLocale(userLocale); String result = invocation.invoke(); HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext.get(HTTP_RESPONSE).setLocale(userLocale); return result; } {code} was (Author: lukaszlenart): But Dispatcher#prepare() method is called before interceptors and action is executed, it's better to do it like this: {code:java} public String intercept(ActionInvocation invocation) throws Exception { [...] [...] invocation.getInvocationContext().setLocale(userLocale); String result = invocation.invoke(); HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext.get(HTTP_RESPONSE).setLocale(userLocale); return result; } {code} > Content-Language in response does not uses the language setup in ActionContext > ------------------------------------------------------------------------------ > > Key: WW-3886 > URL: https://issues.apache.org/jira/browse/WW-3886 > Project: Struts 2 > Issue Type: Bug > Components: Dispatch Filter > Affects Versions: 2.2.3 > Reporter: Jose L Martinez-Avial > Priority: Minor > Fix For: 2.3.9 > > > I've setup the 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: > {code:title=MyInterceptor.java|borderStyle=solid} > public String intercept(ActionInvocation invocation) throws Exception { > [...] > > [...] > invocation.getInvocationContext().setLocale(userLocale); > return invocation.invoke(); > } > {code} > 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 invocation context. > The issue seems to be related to org.apache.struts2.dispatcher.Dispatcher, where the method prepare only takes into account the default locale or the locale in the request, but not the locale that can be setup on the ActionContext by the application. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira