Comprehensive update to the framework's TimeZone handling, including a new TimeZoneAwareLocaleContext and a LocaleContextResolver for Spring MVC

A few noteworthy minor changes: LocaleContext.getLocale() may return null in special cases (not by default), which our own accessing classes are able to handle now. If there is a non-null TimeZone user setting, we're exposing it to all collaborating libraries, in particular to JSTL, Velocity and JasperReports. Our JSR-310 and Joda-Time support falls back to checking the general LocaleContext TimeZone now, adapting it to their time zone types, if no more specific setting has been provided. Our DefaultConversionService has TimeZone<->ZoneId converters registered. And finally, we're using a custom parseTimeZoneString method now that doesn't accept the TimeZone.getTimeZone(String) GMT fallback for an invalid time zone id anymore.

Issue: SPR-1528
This commit is contained in:
Juergen Hoeller
2013-10-04 23:14:08 +02:00
parent 52cca48f40
commit 4574528a27
35 changed files with 1570 additions and 270 deletions

View File

@@ -19,6 +19,8 @@ package org.springframework.beans.propertyeditors;
import java.beans.PropertyEditorSupport;
import java.util.TimeZone;
import org.springframework.util.StringUtils;
/**
* Editor for {@code java.util.TimeZone}, translating timezone IDs into
* {@code TimeZone} objects. Exposes the {@code TimeZone} ID as a text
@@ -33,7 +35,7 @@ public class TimeZoneEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(TimeZone.getTimeZone(text));
setValue(StringUtils.parseTimeZoneString(text));
}
@Override