-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Simplify default locale/timezone resolution in cookie/session locale resolvers #27609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e520124
to
77ce689
Compare
Any feedback on this? |
Hi @vpavic, We just have not gotten to it yet. We'll review it and hopefully get it into 6.0 M5. |
This commit updates AcceptHeaderLocaleResolver to extend AbstractLocaleResolver, which allows the removal of defaultLocale managing code in AcceptHeaderLocaleResolver.
This commit updates LocaleContextResolver to implement LocaleResolver using default methods, which simplifies AbstractLocaleContextResolver and aligns it more closely with AbstractLocaleResolver.
…resolvers At present, the customization of the default locale and timezone resolution in CookieLocaleResolver and SessionLocaleResolver requires subclassing them and overriding determineDefaultLocale and/or determineDefaultTimeZone methods. This commit simplifies resolution of the default locale and timezone resolution by introducing dedicated functions for these purposes, thus allowing the customization without needing to resort to subclassing the locale resolvers.
Thanks @sbrannen. In my notes I had a few other improvement proposals that weren't as straightforward as those included in this PR:
Anyway, let me know what you think of those and I can either add commits to this PR or open separate issues (or PRs) to consider those separately. IMO the whole |
77ce689
to
d6bee29
Compare
I'll assess that after merging the three commits in this PR.
Indeed, 6.0 is a good opportunity for "modernization". |
This commit updates AcceptHeaderLocaleResolver to extend AbstractLocaleResolver, which allows the removal of defaultLocale managing code in AcceptHeaderLocaleResolver. See spring-projectsgh-27609
This commit updates LocaleContextResolver to implement LocaleResolver using default methods, which simplifies AbstractLocaleContextResolver and aligns it more closely with AbstractLocaleResolver. See gh-27609
At present, the customization of the default locale and timezone resolution in
CookieLocaleResolver
andSessionLocaleResolver
requires subclassing them and overridingdetermineDefaultLocale
and/ordetermineDefaultTimeZone
methods.This PR simplifies resolution of the default locale and timezone resolution by introducing dedicated functions for these purposes, thus allowing the customization without needing to resort to subclassing the locale resolvers.
Additionally, there are also 2 small commits that improve some aspects of the
LocaleResolver
hierarchy:Update
AcceptHeaderLocaleResolver
to extendAbstractLocaleResolver
:This commit updates AcceptHeaderLocaleResolver to extend AbstractLocaleResolver, which allows the removal of defaultLocale managing code in AcceptHeaderLocaleResolver.
Update
LocaleContextResolver
to implementLocaleResolver
:This commit updates
LocaleContextResolver
to implementLocaleResolver
using default methods, which simplifiesAbstractLocaleContextResolver
and aligns it more closely withAbstractLocaleResolver
.