public interface LocalePicker extends ConfigurableComponent
A LocalePicker is a class that determines what Locale a particular request will use. At first this may seem odd given that the request already has a method called getLocale(), but ask yourself this: if your site only supports English, and the user's browser requests the Japanese locale, in what locale should you accept their input?
The LocalPicker is given access to the request and can use any mechanism it chooses to decide upon a Locale. However, it must return a valid locale. It is suggested that if a locale cannot be chosen that the picker return the system locale.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
pickCharacterEncoding(javax.servlet.http.HttpServletRequest request,
java.util.Locale locale)
Picks the character encoding to use for the current request using the specified
Locale.
|
java.util.Locale |
pickLocale(javax.servlet.http.HttpServletRequest request)
Picks a locale for the HttpServletRequest supplied.
|
init
java.util.Locale pickLocale(javax.servlet.http.HttpServletRequest request)
request
- the current HttpServletRequestjava.lang.String pickCharacterEncoding(javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
request
- the current HttpServletRequestlocale
- the Locale picked by the LocalePicker for this request? Copyright 2005-2006, Stripes Development Team.