Class CookieLocaleResolver

java.lang.Object
org.springframework.web.util.CookieGenerator
org.springframework.web.servlet.i18n.CookieLocaleResolver
All Implemented Interfaces:
LocaleContextResolver, LocaleResolver

public class CookieLocaleResolver extends CookieGenerator implements LocaleContextResolver
LocaleResolver implementation that uses a cookie sent back to the user in case of a custom setting, with a fallback to the specified default locale or the request's accept-header locale.

This is particularly useful for stateless applications without user sessions. The cookie may optionally contain an associated time zone value as well; alternatively, you may specify a default time zone.

Custom controllers can override the user's locale and time zone by calling #setLocale(Context) on the resolver, e.g. responding to a locale change request. As a more convenient alternative, consider using RequestContext.changeLocale(java.util.Locale).

Since:
27.02.2003
Author:
Juergen Hoeller, Jean-Pierre Pawlak
See Also: