Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-4692

Alfresco ignores Accept-Language sent from Share

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4.5
    • Component/s: Multilingual Content
    • Labels:
      None
    • Environment:
      Windows 7 x64 Professional, sun java 1.6.0_24
    • Bug Priority:
      Category 1

      Description

      When a share webscript calls an alfresco webscript, it includes an Accept-language header; see ScriptRemoteConnector::buildDefaultHeaders.

      However, Alfresco does not honor this header.

      To reproduce, set the JVM default locale to en_US with -Duser.language=en -Duser.country=US.
      The login here is made with a GET request to /api/login, but a POST request to retrieve a session id yields the same results.

      >ncat localhost 8081 -v
      Ncat: Version 5.51 ( http://nmap.org/ncat )
      Ncat: Connected to 127.0.0.1:8081.
      GET /alfresco/wcs/api/login?u=admin&pw=admin HTTP/1.1
      Accept-Language: pt-PT
      Host: localhost:8081

      HTTP/1.1 200 OK
      Cache-Control: no-cache
      Pragma: no-cache
      Content-Type: text/xml;charset=UTF-8
      Transfer-Encoding: chunked
      Server: Jetty(7.3.1.v20110307)

      6A
      <?xml version="1.0" encoding="UTF-8"?>
      <ticket>TICKET_41d85e0314f0aef349e82d3224c5f49fef9d37f3</ticket>

      0

      Set a breakpoint on I18NUtil::setLocale, and then:

      C:\Users\gustavo.lopes>ncat localhost 8081 -v
      Ncat: Version 5.51 ( http://nmap.org/ncat )
      Ncat: Connected to 127.0.0.1:8081.
      GET /alfresco/wcs/api/workflow-definitions?ticket=TICKET_41d85e0314f0aef349e82d3
      224c5f49fef9d37f3&exclude=jbpm$wcmwf:*,jbpm$wf:articleapproval,jbpm$inwf:invitat
      ion-nominated,jbpm$imwf:invitation-moderated&alf_ticket=TICKET_2ecb23c0273b966d0
      451f864e4f32b4a7c6adaa4 HTTP/1.1
      Accept-Language: pt-PT
      Host: glopes.construlink.lo.geleia.net:8081
      Connection: close

      First hit, with locale pt_PT:

      org.springframework.extensions.surf.util.I18NUtil.setLocale(I18NUtil.java:83)
      org.alfresco.web.app.servlet.GlobalLocalizationFilter.setLanguageFromRequestHeader(GlobalLocalizationFilter.java:78)
      org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:55)
      ...
      org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
      java.lang.Thread.run(Thread.java:619)

      Second hit, with locale pt_PT:

      org.springframework.extensions.surf.util.I18NUtil.setLocale(I18NUtil.java:83)
      org.springframework.extensions.webscripts.servlet.WebScriptServlet.setLanguageFromRequestHeader(WebScriptServlet.java:149)
      org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:113)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
      org.alfresco.repo.webdav.auth.BaseSSOAuthenticationFilter.doFilter(BaseSSOAuthenticationFilter.java:134)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      $Proxy390.doFilter(Unknown Source)
      org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:133)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      $Proxy390.doFilter(Unknown Source)
      org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
      ...
      org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
      java.lang.Thread.run(Thread.java:619)

      Third hit, with locale en_US (Application::getLanguage gets 'en_US' from PreferencesService.getPreferences(session).getValue(UserPreferencesBean.PREF_INTERFACELANGUAGE);

      org.alfresco.web.app.Application.getLanguage(Application.java:836)
      org.alfresco.web.app.servlet.AuthenticationHelper.setupThread(AuthenticationHelper.java:115)
      org.alfresco.web.app.servlet.AuthenticationHelper.authenticate(AuthenticationHelper.java:311)
      org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator.authenticate(WebClientAuthenticatorFactory.java:126)
      org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:290)
      org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
      org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
      org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
      org.alfresco.repo.webdav.auth.BaseSSOAuthenticationFilter.doFilter(BaseSSOAuthenticationFilter.java:134)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      $Proxy390.doFilter(Unknown Source)
      org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:133)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      $Proxy390.doFilter(Unknown Source)
      org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
      ...
      org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
      java.lang.Thread.run(Thread.java:619)

      Response:

      HTTP/1.1 200 OK
      Set-Cookie: JSESSIONID=1gu0c63ktbe8p182x3zws0y5aq;Path=/alfresco
      Expires: Thu, 01-Jan-1970 00:00:00 GMT
      Cache-Control: no-cache
      Pragma: no-cache
      Content-Type: application/json;charset=UTF-8
      Connection: close
      Server: Jetty(7.3.1.v20110307)

      {
      "data":
      [
      {
      "id" : "jbpm$3",
      "url": "api\/workflow-definitions\/jbpm$3",
      "name": "jbpm$wf:reviewpooled",
      "title": "Pooled Review & Approve",
      "description": "Pooled review & approval of content",
      ...

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedbugs Closed Bugs (Inactive)
                  Reporter:
                  cataphract Gustavo Lopes (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 day, 2 hours
                    1d 2h

                      Structure Helper Panel