public class

LocaleChangeInterceptor

extends HandlerInterceptorAdapter
java.lang.Object
   ↳ org.springframework.web.servlet.handler.HandlerInterceptorAdapter
     ↳ org.springframework.web.servlet.i18n.LocaleChangeInterceptor

Class Overview

Interceptor that allows for changing the current locale on every request, via a configurable request parameter.

See Also

Summary

Constants
String DEFAULT_PARAM_NAME Default name of the locale specification parameter: "locale".
Public Constructors
LocaleChangeInterceptor()
Public Methods
String getParamName()
Return the name of the parameter that contains a locale specification in a locale change request.
boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
This implementation always returns true.
void setParamName(String paramName)
Set the name of the parameter that contains a locale specification in a locale change request.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
From class java.lang.Object
From interface org.springframework.web.servlet.HandlerInterceptor

Constants

public static final String DEFAULT_PARAM_NAME

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

Constant Value: "locale"

Public Constructors

public LocaleChangeInterceptor ()

Public Methods

public String getParamName ()

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

public boolean preHandle (HttpServletRequest request, HttpServletResponse response, Object handler)

This implementation always returns true.

Parameters
request current HTTP request
response current HTTP response
handler chosen handler to execute, for type and/or instance evaluation
Returns
  • true if the execution chain should proceed with the next interceptor or the handler itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself.
Throws
ServletException

public void setParamName (String paramName)

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