Class LocalizationFilter
java.lang.Object
org.exoplatform.container.web.AbstractFilter
org.exoplatform.portal.application.localization.LocalizationFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
public class LocalizationFilter
extends org.exoplatform.container.web.AbstractFilter
This filter provides
ServletRequest.getLocale() and ServletRequest.getLocales() override for
extra-portlet requests (i.e. unbridged .jsp). Thanks to it dynamic resources can be localized to keep in sync with the rest
of the portal. This filter is re-entrant, and can safely be installed for INCLUDE, FORWARD, and ERROR dispatch methods.
A concrete example of re-entrant use is login/jsp/login.jsp used when authentication fails at portal login.
By default ServletRequest.getLocale() and ServletRequest.getLocales() reflect browser language
preference. When using this filter these two calls employ the same Locale determination algorithm as
LocalizationLifecycle does.
This filter can be activated / deactivated via portal module's web.xml
If default portal language is other than English, it can be configured for the filter by using PortalLocale init param:
<filter>
<filter-name>LocalizationFilter</filter-name>
<filter-class>org.exoplatform.portal.application.localization.LocalizationFilter</filter-class>
<init-param>
<param-name>PortalLocale</param-name>
<param-value>fr_FR</param-value>
</init-param>
</filter>
-
Field Summary
Fields inherited from class org.exoplatform.container.web.AbstractFilter
config, servletContextName -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.exoplatform.container.web.AbstractFilter
getContainer, getServletContext, init, requirePortalEnvironment
-
Constructor Details
-
LocalizationFilter
public LocalizationFilter()
-
-
Method Details
-
afterInit
protected void afterInit(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException - Overrides:
afterInitin classorg.exoplatform.container.web.AbstractFilter- Throws:
jakarta.servlet.ServletException
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
destroy
public void destroy() -
getCurrentLocale
-