DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=36524>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=36524 Summary: Can't set cookie path etc. used by LocaleAction Product: Cocoon 2 Version: 2.1.7 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P3 Component: core AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] I have a sitemap which can return pages in various languages, using the LocaleAction to determine which one to return for any given request. I want to use <store-in-cookie>true</store-in-cookie> in the configuration of the LocaleAction. However, org.apache.cocoon.i18n.I18nUtils.storeLocale(Map, String, String, boolean, boolean, boolean, boolean) uses response.addCookie(response.createCookie(attribute, locale)); and org.apache.cocoon.environment.http.HttpResponse.createCookie(String, String) simply does return new HttpCookie(name, value); which means that although addCookie would set the the cookie domain/path/expiry to whatever is on the cookie it is passed, in practise the LocaleAction will always use the javax.servlet.http.Cookie defaults. My site has a reasonably deep page hierarchy. Unfortunately, by default the cookies are only returned at or below the level of the page which set them. So, if I request e.g /site/a?locale=en followed by /site/a/b?locale=zh_CN to switch the site to the Chinese version, I end up with two locale cookies stored for the site at different levels, and a subsequent request for /site/c returns the English version of the page instead of Chinese as was selected last :-( In fact, if I select a different languages in several pages in various locations around the site, I can easily find myself browsing around and getting a different language on every page I visit! The other limitation, of course, is that the default MaxAge value is -1, forcing the browser to use a session cookie. This means that if the user switches to a non-default (as determined by the Accept-Language header) language, then they'll have to do this again next time they come back to the site. It would be nice to be able to specify e.g. a one month expiry on the cookie instead. I'm guessing this shouldn't be too difficult to add since o.a.c.environment.http.HttpCookie already contains setters for these other fields; just (!) some extra optional configuration parameters for LocaleAction to go with store-in-cookie, overload the storeLocale method in I18Utils to take the extra arguments and call the additional setters between the createCookie and addCookie calls...? -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
