struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose L Martinez-Avial (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-3886) Content-Language in response does not uses the language setup in ActionContext
Date Sun, 27 Jan 2013 19:43:12 GMT

    [ https://issues.apache.org/jira/browse/WW-3886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13563903#comment-13563903
] 

Jose L Martinez-Avial commented on WW-3886:
-------------------------------------------

Well, your suggestion works, but it seems the content-locale can only be set before the response
is committed, since doing it after the invocation.invoke did not have any effect. I had to
do the following"

HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(ServletActionContext.HTTP_RESPONSE);
response.setLocale(requestLocale);

final String result = invocation.invoke();
return result;

                
> 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
>            Assignee: Lukasz Lenart
>            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 {
> [...]
> <get locale for the user>
> [...]
> 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

Mime
View raw message