Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Nested Class Summary
`protected class` | `I18nInterceptor.CookieLocaleFinder`

Nested classes/interfaces inherited from class com.opensymphony.xwork2.interceptor.I18nInterceptor
`I18nInterceptor.LocaleFinder, I18nInterceptor.Storage`

Field Summary
`static String` | `COOKIE_STORAGE`
`static String` | `DEFAULT_COOKIE_ATTRIBUTE`
`static String` | `DEFAULT_COOKIE_PARAMETER`
`protected String` | `requestCookieParameterName`

Fields inherited from class com.opensymphony.xwork2.interceptor.I18nInterceptor
`attributeName, DEFAULT_PARAMETER, DEFAULT_REQUESTONLY_PARAMETER, DEFAULT_SESSION_ATTRIBUTE, LOG, parameterName, requestOnlyParameterName`

Constructor Summary
`I18nInterceptor()`

Method Summary
`String` | `intercept(ActionInvocation invocation)`
`protected Locale` | `readStoredLocale(ActionInvocation invocation, Map<String,Object> session)`
`void` | `setRequestCookieParameterName(String requestCookieParameterName)`
`protected Locale` | `storeLocale(ActionInvocation invocation, Locale locale, String storage)`

Methods inherited from class com.opensymphony.xwork2.interceptor.I18nInterceptor
`findLocaleParameter, getLocaleFromParam, readStoredLocalFromCurrentInvocation, readStoredLocalFromSession, saveLocale, setAttributeName, setParameterName, setRequestOnlyParameterName`

Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
`destroy, init`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### 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

Constructor Detail

### I18nInterceptor

    public I18nInterceptor()

Method Detail

### 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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.