Tapestry
  1. Tapestry
  2. TAPESTRY-399

If a RedirectException is thrown after IEngine.setLocale(...) has been called, the cookie org.apache.tapestry.locale is not being set

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.3
    • Component/s: Framework
    • Labels:
      None

      Description

      At the moment it seems not to be possible to change the engine locale and redirect to the current page so the locale settings take effect immediatly. As you can see I tried doing the redirect manually (via .forward()), but that didn't change a thing.

      WORK AROUND -------------------------
      Work-around (this seems to work in Beta 2):
      @InjectObject("infrastructure:cookieSource")
      public abstract CookieSource getCookieSource();

      then in the listener do:
      // note that Locale.toString() returns the programmatic code of the locale (for example "de_DE" or "en_US")
      getCookieSource().writeCookieValue("org.apache.tapestry.locale", Locale.GERMANY.toString());
      throw new RedirectException([myurl]);

      TEST CODE -------------------------

      template:
      <a jwcid="@ActionLink" stateful="false" listener="ognl:listeners.changeToGerman">de</a>

      listener:

      public void changeToGerman(IRequestCycle cycle)

      { cycle.getEngine().setLocale(Locale.GERMANY); // this also does not send the cookie // cycle.getInfrastructure().getRequest().forward(getEngineService().getLink(cycle, cycle.getPage().getPageName()).getAbsoluteURL()); throw new RedirectException(getEngineService().getLink(cycle, cycle.getPage().getPageName()).getURL()); }

      @InjectObject("engine-service:page")
      public abstract IEngineService getEngineService();

      Header dump:

      actual response:
      HTTP/1.x 302 Moved Temporarily
      Server: Apache-Coyote/1.1
      Location: http://localhost:81/cip/Home.cip
      Content-Length: 0
      Date: Thu, 14 Jul 2005 14:04:57 GMT

      expected response:
      HTTP/1.x 302 Moved Temporarily
      Server: Apache-Coyote/1.1
      Location: http://localhost:81/cip/Home.cip
      Content-Length: 0
      Date: Thu, 14 Jul 2005 14:04:57 GMT
      Set-Cookie: org.apache.tapestry.locale=de_DE; Path=/cip

        Activity

        Jonas Maurus created issue -
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Affects Version/s 4.1.2 [ 12312202 ]
        Affects Version/s 4.0 [ 10794 ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.2 [ 12312202 ]
        Jesse Kuhnert made changes -
        Resolution Invalid [ 6 ]
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Jesse Kuhnert [ jkuhnert ]
        Jonas Maurus made changes -
        Resolution Invalid [ 6 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.2 [ 12312202 ]
        Fix Version/s 4.1.3 [ 12312516 ]
        Jesse Kuhnert made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Resolved [ 5 ]
        Mark Thomas made changes -
        Workflow jira [ 12322272 ] Default workflow, editable Closed status [ 12569057 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569057 ] jira [ 12590335 ]

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Jonas Maurus
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development