php-coder / mystamps

The site about post stamps where you can create a virtual collection
https://my-stamps.ru
GNU General Public License v2.0
20 stars 33 forks source link

Change cookie name #375

Open php-coder opened 8 years ago

php-coder commented 8 years ago

I would like to rename them from myLocaleCookie to locale

(Update: Spring Boot 2 introduced server.servlet.session.cookie.name -- perhaps, it can be useful.) (Update: we can rename JSESSIONID as well.)

cssru commented 8 years ago

Hmm...it doesn't create any cookie except JSESSIONID.

cssru commented 8 years ago

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?

php-coder commented 8 years ago

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?

cssru commented 8 years ago

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.

cssru commented 8 years ago

Probably SessionLocaleResolver uses HttpSession to store selected locale as SessionAttribute. Also probably HttpSession stores its attributes in something like ThreadLocal. So I have a question - Where cookie are used?