spring-framework / org.springframework.web.servlet.i18n / LocaleChangeInterceptor

LocaleChangeInterceptor

open class LocaleChangeInterceptor : HandlerInterceptorAdapter

Interceptor that allows for changing the current locale on every request, via a configurable request parameter (default parameter name: "locale").

Author
Juergen Hoeller

Author
Rossen Stoyanchev

Since
20.06.2003

See Also
org.springframework.web.servlet.LocaleResolver

Constructors

<init>

LocaleChangeInterceptor()

Interceptor that allows for changing the current locale on every request, via a configurable request parameter (default parameter name: "locale").

Properties

DEFAULT_PARAM_NAME

static val DEFAULT_PARAM_NAME: String

Default name of the locale specification parameter: "locale".

Functions

getHttpMethods

open fun getHttpMethods(): Array<String>

Return the configured HTTP methods.

getParamName

open fun getParamName(): String

Return the name of the parameter that contains a locale specification in a locale change request.

isIgnoreInvalidLocale

open fun isIgnoreInvalidLocale(): Boolean

Return whether to ignore an invalid value for the locale parameter.

isLanguageTagCompliant

open fun isLanguageTagCompliant(): Boolean

Return whether to use BCP 47 language tags instead of Java's legacy locale specification format.

preHandle

open fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean

setHttpMethods

open fun setHttpMethods(vararg httpMethods: String): Unit

Configure the HTTP method(s) over which the locale can be changed.

setIgnoreInvalidLocale

open fun setIgnoreInvalidLocale(ignoreInvalidLocale: Boolean): Unit

Set whether to ignore an invalid value for the locale parameter.

setLanguageTagCompliant

open fun setLanguageTagCompliant(languageTagCompliant: Boolean): Unit

Specify whether to parse request parameter values as BCP 47 language tags instead of Java's legacy locale specification format. The default is false.

setParamName

open fun setParamName(paramName: String): Unit

Set the name of the parameter that contains a locale specification in a locale change request. Default is "locale".