Open php-coder opened 8 years ago
Hmm...it doesn't create any cookie except JSESSIONID.
Ahh...that's why! You're using session locale resolver. To use cookies for user locale storing you should use cookie locale resolver. Wanna I set it up instead session resolver?
It's not clear for me what's wrong with current setup and why we should switch to something else. Yes, I'm using session locale resolver. And Spring MVC remembers it's value it the cookie already. And why I need to change it for something else? Why we can't configure it?
Explain, please, where cookie is set? I have read http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/i18n/SessionLocaleResolver.html and it says that no cookies are used. Also i checked cookies created in my Google Chrome. There is session cookie only.
Probably SessionLocaleResolver uses HttpSession to store selected locale as SessionAttribute.
Also probably HttpSession stores its attributes in something like ThreadLocal
I would like to rename them from
myLocaleCookie
tolocale
(Update: Spring Boot 2 introduced
server.servlet.session.cookie.name
-- perhaps, it can be useful.) (Update: we can renameJSESSIONID
as well.)