org.loom.config
Class CookieLocaleResolver
java.lang.Object
org.loom.config.CookieLocaleResolver
- All Implemented Interfaces:
- LocaleResolver
@Singleton
public class CookieLocaleResolver
- extends java.lang.Object
- implements LocaleResolver
Locale stored in a cookie cookie.
Method Summary |
java.util.Locale |
getLocale(javax.servlet.http.HttpServletRequest request)
Extract the locale from the user request, null if it no serialized locale could be found. |
void |
setCookieName(java.lang.String cookieName)
|
void |
setLocale(javax.servlet.http.HttpServletResponse response,
java.util.Locale locale)
Change the locale on the user request |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CookieLocaleResolver
public CookieLocaleResolver()
getLocale
public java.util.Locale getLocale(javax.servlet.http.HttpServletRequest request)
- Description copied from interface:
LocaleResolver
- Extract the locale from the user request, null if it no serialized locale could be found.
If null, the locale from the request instance will be used.
- Specified by:
getLocale
in interface LocaleResolver
- Parameters:
request
- the current user request
- Returns:
- the locale to apply for this request
setLocale
public void setLocale(javax.servlet.http.HttpServletResponse response,
java.util.Locale locale)
- Description copied from interface:
LocaleResolver
- Change the locale on the user request
- Specified by:
setLocale
in interface LocaleResolver
- Parameters:
response
- the response to set the locale intolocale
- the new Locale to apply
setCookieName
public void setCookieName(java.lang.String cookieName)