|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.base.Adaptee org.norther.tammi.spray.filter.DefaultFilter org.norther.tammi.spray.filter.DefaultKeyFilter org.norther.tammi.spray.terminal.DefaultLocaleFilter
public class DefaultLocaleFilter
A default implementation of LocaleFilter.
Field Summary | |
---|---|
static String |
LOCALE_KEY
The default key for the locale. |
Fields inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter |
---|
DEFAULT_KEY |
Fields inherited from class org.norther.tammi.core.base.Adaptee |
---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
Constructor Summary | |
---|---|
DefaultLocaleFilter()
Constructs a new filter. |
|
DefaultLocaleFilter(String key)
Constructs a new filter with a key. |
Method Summary | |
---|---|
void |
addSupportedLocale(Locale locale)
Adds a supported locale. |
void |
clearNativeCountries()
Clears all native countries. |
void |
clearSupportedLocales()
Clears all supported locales. |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
|
Locale |
getDefaultLocale()
Gets the default locale for the response. |
protected Locale |
getKeyLocale(ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the key value as locale. |
String |
getNativeCountry(String lang)
Gets the native country for the specified language. |
Locale[] |
getSupportedLocales()
Gets supported locales. |
boolean |
isForcedLocale()
Checks whether a cached locale should be ignored and apply either the request specific locale or the default locale. |
Set<String> |
languageSet()
Returns a read-only set of languages with native countries. |
void |
removeNativeCountry(String lang)
Removes the native country for the specified language. |
void |
removeSupportedLocale(Locale locale)
Removes a supported locale. |
void |
setDefaultLocale(Locale locale)
Sets the default locale for the response. |
void |
setForcedLocale(boolean flag)
Sets the forced locale option determining whether a cached locale should be ignored or not. |
void |
setNativeCountry(String lang,
String country)
Sets the native country for the specified language. |
void |
setSupportedLocales(Locale[] locales)
Sets supported locales. |
Methods inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter |
---|
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey |
Methods inherited from class org.norther.tammi.spray.filter.DefaultFilter |
---|
destroy, getFilterConfig, getRequestMap, getSessionMap, init |
Methods inherited from class org.norther.tammi.core.base.Adaptee |
---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter |
---|
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey |
Methods inherited from interface javax.servlet.Filter |
---|
destroy, init |
Field Detail |
---|
public static final String LOCALE_KEY
Constructor Detail |
---|
public DefaultLocaleFilter()
public DefaultLocaleFilter(String key)
key
- the filter key.Method Detail |
---|
public Locale getDefaultLocale()
LocaleFilter
getDefaultLocale
in interface LocaleFilter
public void setDefaultLocale(Locale locale)
LocaleFilter
setDefaultLocale
in interface LocaleFilter
locale
- the default locale.public boolean isForcedLocale()
LocaleFilter
isForcedLocale
in interface LocaleFilter
public void setForcedLocale(boolean flag)
LocaleFilter
setForcedLocale
in interface LocaleFilter
flag
- the forced locale option.public Locale[] getSupportedLocales()
LocaleFilter
getSupportedLocales
in interface LocaleFilter
public void setSupportedLocales(Locale[] locales)
LocaleFilter
setSupportedLocales
in interface LocaleFilter
locales
- an array of supported locales.public void addSupportedLocale(Locale locale)
LocaleFilter
addSupportedLocale
in interface LocaleFilter
locale
- the supported locale.public void removeSupportedLocale(Locale locale)
LocaleFilter
removeSupportedLocale
in interface LocaleFilter
locale
- the supported locale.public void clearSupportedLocales()
LocaleFilter
clearSupportedLocales
in interface LocaleFilter
public String getNativeCountry(String lang)
LocaleFilter
getNativeCountry
in interface LocaleFilter
lang
- the language.
public void setNativeCountry(String lang, String country)
LocaleFilter
setNativeCountry
in interface LocaleFilter
lang
- the language.country
- the country.public void removeNativeCountry(String lang)
LocaleFilter
removeNativeCountry
in interface LocaleFilter
lang
- the language.public void clearNativeCountries()
LocaleFilter
clearNativeCountries
in interface LocaleFilter
public Set<String> languageSet()
LocaleFilter
languageSet
in interface LocaleFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException
doFilter
in interface Filter
doFilter
in class DefaultFilter
ServletException
IOException
protected Locale getKeyLocale(ServletRequest request, ServletResponse response, FilterChain chain)
request
- the request.response
- the response.chain
- the filter chain.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |