Skip to content

Added TimeZone support to Spring i18n #298

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

Closed
wants to merge 1 commit into from

Conversation

beamerblvd
Copy link
Contributor

Added support to Spring Framework i18n for use TimeZones. This
support is based largely off the Locale support. The TimeZoneResolver
interface parallels the LocaleResolver interface and so do most of
its implementations. The TimeZoneChangeInterceptor mirrors the
LocaleChangeInterceptor. Use of the TimeZoneContextHolder is the same
as using the LocaleContextHolder, and the RequestContext and
RequestContextUtils classes have TimeZone-related methods that mirror
the Locale-related methods.

As it does with LocaleResolver, DispatcherServlet now exposes a
TimeZoneResolver and context. The JstlUtils take into account and
expose TimeZones to the target JSP context, just like with Locales,
so that <fmt:formatDate> and the like can take advantage of the
selected TimeZone. The Velocity and Jasper Report views have also
been updated to use the TimeZone (they were the only other view types
whose 3rd party libraries consumed TimeZones but Spring was ignoring
that).

Everything was set up so that out-of-the-box, Spring and everything
it affects continue to use the System Default time zone without
configuration to the contrary. This way, behavior should not change
for users that don't set up TimeZone support.

This change includes 69 unit tests to back up my changes. I have also
thoroughly functionally tested the changes in my target application.
All new classes are well-documented with JavaDoc and the JavaDoc of
classes affected by these changes have been updated as appropriate.

Issue: SPR-1528

Adding support to Spring Framework i18n for use TimeZones. This
support is based largely off the Locale support. The TimeZoneResolver
interface parallels the LocaleResolver interface and so do most of
its implementations. The TimeZoneChangeInterceptor mirrors the
LocaleChangeInterceptor. Use of the TimeZoneContextHolder is the same
as using the LocaleContextHolder, and the RequestContext and
RequestContextUtils classes have TimeZone-related methods that mirror
the Locale-related methods.

As it does with LocaleResolver, DispatcherServlet now exposes a
TimeZoneResolver and context. The JstlUtils take into account and
expose TimeZones to the target JSP context, just like with Locales,
so that <fmt:formatDate> and the like can take advantage of the
selected TimeZone. The Velocity and Jasper Report views have also
been updated to use the TimeZone (they were the only other view types
whose 3rd party libraries consumed TimeZones but Spring was ignoring
that).

Everything was set up so that out-of-the-box, Spring and everything
it affects continue to use the System Default time zone without
configuration to the contrary. This way, behavior should not change
for users that don't set up TimeZone support.

This change includes 69 unit tests to back up my changes. I have also
thoroughly functionally tested the changes in my target application.
All new classes are well-documented with JavaDoc and the JavaDoc of
classes affected by these changes have been updated as appropriate.

Issue: SPR-1528
@beamerblvd
Copy link
Contributor Author

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

@beamerblvd
Copy link
Contributor Author

Has anyone had a chance to look at this? I'm eager to make any revisions necessary so that we can get this merged. Some of the classes affected (DispatcherServlet, FrameworkServlet, etc.) are often-changed, and I'd hate for the merge to get messy and create a lot of work for y'all.

@beamerblvd
Copy link
Contributor Author

According to JIRA, 4.0 M2 releases today. @philwebb said he wanted to get this into Milestone 2, and I share that desire. If there are simple revisions that need to be made, I can turn that around in 2-3 hours this afternoon. If there are more major revisions that need to be made, it's going to take me several days. @jhoeller, has this reached the top of your list yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants