Simplify default locale/timezone resolution in cookie/session locale resolvers#27609
Simplify default locale/timezone resolution in cookie/session locale resolvers#27609vpavic wants to merge 3 commits into
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
CookieLocaleResolverandSessionLocaleResolverrequires subclassing them and overridingdetermineDefaultLocaleand/ordetermineDefaultTimeZonemethods.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
LocaleResolverhierarchy:Update
AcceptHeaderLocaleResolverto extendAbstractLocaleResolver:This commit updates AcceptHeaderLocaleResolver to extend AbstractLocaleResolver, which allows the removal of defaultLocale managing code in AcceptHeaderLocaleResolver.
Update
LocaleContextResolverto implementLocaleResolver:This commit updates
LocaleContextResolverto implementLocaleResolverusing default methods, which simplifiesAbstractLocaleContextResolverand aligns it more closely withAbstractLocaleResolver.