org.apache.struts2.interceptor
Class I18nInterceptor
java.lang.Object
com.opensymphony.xwork2.interceptor.AbstractInterceptor
com.opensymphony.xwork2.interceptor.I18nInterceptor
org.apache.struts2.interceptor.I18nInterceptor
- All Implemented Interfaces:
- Interceptor, Serializable
public class I18nInterceptor
- extends I18nInterceptor
This interceptor extends the original xwork i18n interceptor
and adds functionality to support cookies.
- parameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save
in the session. By default this is request_locale
- requestCookieParameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to
and save in a cookien. By default this is request_cookie_locale
- requestOnlyParameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to
for the current request only, without saving it in the session. By default this is request_only_locale
- attributeName (optional) - the name of the session key to store the selected locale. By default this is
WW_TRANS_I18N_LOCALE
<interceptor name="i18nCookie" class="org.apache.struts2.interceptor.I18nInterceptor"/>
<action name="someAction" class="com.examples.SomeAction">
<interceptor-ref name="i18nCookie"/>
<interceptor-ref name="basicStack"/>
<result name="success">good_result.ftl</result>
</action>
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_COOKIE_ATTRIBUTE
public static final String DEFAULT_COOKIE_ATTRIBUTE
- See Also:
- Constant Field Values
COOKIE_STORAGE
public static final String COOKIE_STORAGE
- See Also:
- Constant Field Values
DEFAULT_COOKIE_PARAMETER
public static final String DEFAULT_COOKIE_PARAMETER
- See Also:
- Constant Field Values
requestCookieParameterName
protected String requestCookieParameterName
I18nInterceptor
public I18nInterceptor()
intercept
public String intercept(ActionInvocation invocation)
throws Exception
- Specified by:
intercept
in interface Interceptor
- Overrides:
intercept
in class I18nInterceptor
- Throws:
Exception
storeLocale
protected Locale storeLocale(ActionInvocation invocation,
Locale locale,
String storage)
- Overrides:
storeLocale
in class I18nInterceptor
readStoredLocale
protected Locale readStoredLocale(ActionInvocation invocation,
Map<String,Object> session)
- Overrides:
readStoredLocale
in class I18nInterceptor
setRequestCookieParameterName
public void setRequestCookieParameterName(String requestCookieParameterName)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.