Class LocaleChangeInterceptor
- java.lang.Object
-
- com.aspectran.core.support.i18n.locale.LocaleChangeInterceptor
-
public class LocaleChangeInterceptor extends java.lang.Object
Interceptor 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.String
DEFAULT_LOCALE_PARAM_NAME
Default name of the locale specification parameter: "locale".static java.lang.String
DEFAULT_TIMEZONE_PARAM_NAME
Default name of the timezone specification parameter: "timezone".
-
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.String
getLocaleParamName()
Return the name of the parameter that contains a locale specification in a locale change request.java.lang.String
getTimeZoneParamName()
Return the name of the parameter that contains a timezone specification in a timezone change request.void
handle(Translet translet, LocaleResolver localeResolver)
boolean
isIgnoreInvalidLocale()
Return whether to ignore an invalid value for the locale parameter.void
setIgnoreInvalidLocale(boolean ignoreInvalidLocale)
Set whether to ignore an invalid value for the locale parameter.void
setLocaleParamName(java.lang.String localeParamName)
Set the name of the parameter that contains a locale specification in a locale change request.void
setRequestMethods(java.lang.String... requestMethods)
Configure the request method(s) over which the locale can be changed.void
setTimeZoneParamName(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
-
-
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)
-
-