类 LocaleChangeInterceptor
java.lang.Object
cn.taketoday.web.i18n.LocaleChangeInterceptor
- 所有已实现的接口:
HandlerInterceptor
Interceptor that allows for changing the current locale on every request,
via a configurable request parameter (default parameter name: "locale").
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Rossen Stoyanchev, Harry Yang
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final StringDefault name of the locale specification parameter: "locale".private String[]private booleanprivate LocaleResolverprotected final cn.taketoday.logging.Loggerprivate String从接口继承的字段 cn.taketoday.web.HandlerInterceptor
EMPTY_ARRAY, NONE_RETURN_VALUE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleanbeforeProcess(RequestContext request, Object handler) Before Handler process.private booleancheckHttpMethod(String currentMethod) String[]Return the configured HTTP methods.Return LocaleResolver.Return the name of the parameter that contains a locale specification in a locale change request.booleanReturn whether to ignore an invalid value for the locale parameter.protected LocaleparseLocaleValue(String localeValue) Parse the given locale value as coming from a request parameter.voidsetHttpMethods(String... httpMethods) Configure the HTTP method(s) over which the locale can be changed.voidsetIgnoreInvalidLocale(boolean ignoreInvalidLocale) Set whether to ignore an invalid value for the locale parameter.voidsetLocaleResolver(LocaleResolver localeResolver) Configure LocaleResolvervoidsetParamName(String paramName) Set the name of the parameter that contains a locale specification in a locale change request.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.web.HandlerInterceptor
afterProcess, intercept
-
字段详细资料
-
DEFAULT_PARAM_NAME
Default name of the locale specification parameter: "locale".- 另请参阅:
-
logger
protected final cn.taketoday.logging.Logger logger -
paramName
-
httpMethods
-
ignoreInvalidLocale
private boolean ignoreInvalidLocale -
localeResolver
-
-
构造器详细资料
-
LocaleChangeInterceptor
public LocaleChangeInterceptor()
-
-
方法详细资料
-
setParamName
Set the name of the parameter that contains a locale specification in a locale change request. Default is "locale". -
getParamName
Return the name of the parameter that contains a locale specification in a locale change request. -
setHttpMethods
Configure the HTTP method(s) over which the locale can be changed.- 参数:
httpMethods- the methods
-
getHttpMethods
Return the configured HTTP methods. -
setIgnoreInvalidLocale
public void setIgnoreInvalidLocale(boolean ignoreInvalidLocale) Set whether to ignore an invalid value for the locale parameter. -
isIgnoreInvalidLocale
public boolean isIgnoreInvalidLocale()Return whether to ignore an invalid value for the locale parameter. -
setLocaleResolver
Configure LocaleResolver -
getLocaleResolver
Return LocaleResolver. -
beforeProcess
从接口复制的说明:HandlerInterceptorBefore Handler process.- 指定者:
beforeProcess在接口中HandlerInterceptor- 参数:
request- Current request Contexthandler- Request handler ,HandlerMethod- 返回:
- If is it possible to execute the target handler
- 另请参阅:
-
checkHttpMethod
-
parseLocaleValue
Parse the given locale value as coming from a request parameter.The default implementation calls
StringUtils.parseLocale(String), accepting theLocale.toString()format as well as BCP 47 language tags.- 参数:
localeValue- the locale value to parse- 返回:
- the corresponding
Localeinstance
-