Class LocaleChangeInterceptor
- java.lang.Object
-
- com.aspectran.core.support.i18n.locale.LocaleChangeInterceptor
-
public class LocaleChangeInterceptor extends java.lang.ObjectInterceptor that allows for changing the current locale on every request, via a configurable request parameter (default parameter name: "locale").Created: 2016. 3. 13.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_LOCALE_PARAM_NAMEDefault name of the locale specification parameter: "locale".static java.lang.StringDEFAULT_TIMEZONE_PARAM_NAMEDefault name of the timezone specification parameter: "timezone".protected Loglog
-
Constructor Summary
Constructors Constructor Description LocaleChangeInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getAllowedMethods()Return the configured HTTP methods.java.lang.StringgetLocaleParamName()Return the name of the parameter that contains a locale specification in a locale change request.java.lang.StringgetTimeZoneParamName()Return the name of the parameter that contains a timezone specification in a timezone change request.voidhandle(Translet translet, LocaleResolver localeResolver)booleanisIgnoreInvalidLocale()Return whether to ignore an invalid value for the locale parameter.voidsetIgnoreInvalidLocale(boolean ignoreInvalidLocale)Set whether to ignore an invalid value for the locale parameter.voidsetLocaleParamName(java.lang.String localeParamName)Set the name of the parameter that contains a locale specification in a locale change request.voidsetRequestMethods(java.lang.String... requestMethods)Configure the request method(s) over which the locale can be changed.voidsetTimeZoneParamName(java.lang.String timezoneParamName)Set the name of the parameter that contains a timezone specification in a locale change request.
-
-
-
Field Detail
-
DEFAULT_LOCALE_PARAM_NAME
public static final java.lang.String DEFAULT_LOCALE_PARAM_NAME
Default name of the locale specification parameter: "locale".- See Also:
- Constant Field Values
-
DEFAULT_TIMEZONE_PARAM_NAME
public static final java.lang.String DEFAULT_TIMEZONE_PARAM_NAME
Default name of the timezone specification parameter: "timezone".- See Also:
- Constant Field Values
-
log
protected final Log log
-
-
Method Detail
-
setLocaleParamName
public void setLocaleParamName(java.lang.String localeParamName)
Set the name of the parameter that contains a locale specification in a locale change request. Default is "locale".- Parameters:
localeParamName- the locale parameter name
-
setTimeZoneParamName
public void setTimeZoneParamName(java.lang.String timezoneParamName)
Set the name of the parameter that contains a timezone specification in a locale change request. Default is "timezone".- Parameters:
timezoneParamName- the timezone parameter name
-
getLocaleParamName
public java.lang.String getLocaleParamName()
Return the name of the parameter that contains a locale specification in a locale change request.- Returns:
- the locale parameter name
-
getTimeZoneParamName
public java.lang.String getTimeZoneParamName()
Return the name of the parameter that contains a timezone specification in a timezone change request.- Returns:
- the time zone parameter name
-
setRequestMethods
public void setRequestMethods(java.lang.String... requestMethods)
Configure the request method(s) over which the locale can be changed.- Parameters:
requestMethods- the methods
-
getAllowedMethods
public java.lang.String[] getAllowedMethods()
Return the configured HTTP methods.- Returns:
- the string [ ]
-
setIgnoreInvalidLocale
public void setIgnoreInvalidLocale(boolean ignoreInvalidLocale)
Set whether to ignore an invalid value for the locale parameter.- Parameters:
ignoreInvalidLocale- whether ignoring invalid locale
-
isIgnoreInvalidLocale
public boolean isIgnoreInvalidLocale()
Return whether to ignore an invalid value for the locale parameter.- Returns:
- whether ignoring invalid locale
-
handle
public void handle(Translet translet, LocaleResolver localeResolver)
-
-