org.loom.config
Class PrefixLocaleResolver
java.lang.Object
org.loom.config.PrefixLocaleResolver
- All Implemented Interfaces:
- LocaleResolver
@Singleton
public class PrefixLocaleResolver
- extends java.lang.Object
- implements LocaleResolver
Locale managed as a hostname prefix, eg: es.foo.com.
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 |
setLocale(javax.servlet.http.HttpServletResponse response,
java.util.Locale locale)
Change the locale on the user request |
void |
setLocalePattern(java.util.regex.Pattern localePattern)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PrefixLocaleResolver
public PrefixLocaleResolver()
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
setLocalePattern
public void setLocalePattern(java.util.regex.Pattern localePattern)