Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3886

Content-Language in response does not uses the language setup in ActionContext

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 2.2.3
    • 2.3.12
    • Dispatch Filter
    • None

    Description

      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:

      MyInterceptor.java
      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 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.

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            jlmagc Jose L Martinez-Avial
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: