[
https://issues.apache.org/jira/browse/TAPESTRY-2392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Albert Tumanov updated TAPESTRY-2392:
-------------------------------------
Description:
The org.apache.tapestry.locale cookie is used in Tapestry to remember last
language choice made by the user.
The problem is, the cookie expires in 7 days, and after it is removed from
browser it never gets set again
until the application is restarted.
The test case follows.
Home.html:
<html jwcid="$content$">
<body jwcid="@Shell" title="Home">
<p>
The current engine locale is: <span jwcid="@Insert" value="ognl:locale" />
</p>
<p>
Cookie received: <span jwcid="@Insert"
value="ognl:getCookieSource().readCookieValue('org.apache.tapestry.locale')" />
</p>
<p>
<a href="#" jwcid="@DirectLink" listener="listener:doClick">Set locale to
'et'</a>
</p>
</body>
</html>
Home.java
package org.example.pages;
import java.util.Locale;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.PageRedirectException;
import org.apache.tapestry.annotations.InjectObject;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.services.CookieSource;
import org.apache.tapestry.services.ResponseBuilder;
/**
* Start page of "myapp".
*/
abstract public class Home extends BasePage {
@InjectObject("infrastructure:cookieSource")
public abstract CookieSource getCookieSource();
public void doClick(IRequestCycle cycle) {
Locale locale = new Locale("et");
getEngine().setLocale(locale);
cycle.cleanup();
throw new PageRedirectException(getPageName());
}
}
Steps to reproduce:
1) Start the application, go to the Home page (http://localhost:8080/myapp/app)
2) click "Set locale to 'et'"
3) go to the Home page again (http://localhost:8080/myapp/app)
4) you will see that the current locale is "et" and cookie is set accordingly
5) now simulate cookie expiration by manually removing it from browser
6) without restarting the application, go to the Home page again
7) click "Set locale to 'et'"
8) check that cookie is still not set and you cannot set it without restarting
the application
Expected:
8) cookie is set
The bug is similar to TAPESTRY-399, but not the same.
Workaround: same as in TAPESTRY-399 (set the cookie manually).
was:
The org.apache.tapestry.locale cookie is used in Tapestry to remember last
language choice made by the user.
But the problem is, the cookie expires in 7 days, and after it is removed from
browser it never gets set again
(until the application is restarted).
Test case:
<html jwcid="$content$">
<body jwcid="@Shell" title="Hello">
<p>
The current engine locale is: <span jwcid="@Insert" value="ognl:locale" />
</p>
<p>
Cookie received: <span jwcid="@Insert"
value="ognl:getCookieSource().readCookieValue('org.apache.tapestry.locale')" />
</p>
<p>
<a href="#" jwcid="@DirectLink" listener="listener:doClick">Set locale to
'et'</a>
</p>
</body>
</html>
> Locale cookie not set after its expiration
> ------------------------------------------
>
> Key: TAPESTRY-2392
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2392
> Project: Tapestry
> Issue Type: Bug
> Components: Framework
> Affects Versions: 4.1.5
> Reporter: Albert Tumanov
> Priority: Minor
>
> The org.apache.tapestry.locale cookie is used in Tapestry to remember last
> language choice made by the user.
> The problem is, the cookie expires in 7 days, and after it is removed from
> browser it never gets set again
> until the application is restarted.
> The test case follows.
> Home.html:
> <html jwcid="$content$">
> <body jwcid="@Shell" title="Home">
> <p>
> The current engine locale is: <span jwcid="@Insert" value="ognl:locale" />
> </p>
> <p>
> Cookie received: <span jwcid="@Insert"
> value="ognl:getCookieSource().readCookieValue('org.apache.tapestry.locale')"
> />
> </p>
> <p>
> <a href="#" jwcid="@DirectLink" listener="listener:doClick">Set locale to
> 'et'</a>
> </p>
> </body>
> </html>
> Home.java
> package org.example.pages;
> import java.util.Locale;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.PageRedirectException;
> import org.apache.tapestry.annotations.InjectObject;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.services.CookieSource;
> import org.apache.tapestry.services.ResponseBuilder;
> /**
> * Start page of "myapp".
> */
> abstract public class Home extends BasePage {
> @InjectObject("infrastructure:cookieSource")
> public abstract CookieSource getCookieSource();
> public void doClick(IRequestCycle cycle) {
> Locale locale = new Locale("et");
> getEngine().setLocale(locale);
> cycle.cleanup();
> throw new PageRedirectException(getPageName());
> }
> }
> Steps to reproduce:
> 1) Start the application, go to the Home page
> (http://localhost:8080/myapp/app)
> 2) click "Set locale to 'et'"
> 3) go to the Home page again (http://localhost:8080/myapp/app)
> 4) you will see that the current locale is "et" and cookie is set accordingly
> 5) now simulate cookie expiration by manually removing it from browser
> 6) without restarting the application, go to the Home page again
> 7) click "Set locale to 'et'"
> 8) check that cookie is still not set and you cannot set it without
> restarting the application
> Expected:
> 8) cookie is set
> The bug is similar to TAPESTRY-399, but not the same.
> Workaround: same as in TAPESTRY-399 (set the cookie manually).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]