public class I18nInterceptor extends I18nInterceptor
This interceptor extends the original xwork i18n interceptor and adds functionality to support cookies.
Modifier and Type | Class and Description |
---|---|
protected class |
I18nInterceptor.CookieLocaleFinder |
I18nInterceptor.LocaleFinder, I18nInterceptor.Storage
Modifier and Type | Field and Description |
---|---|
static String |
COOKIE_STORAGE |
static String |
DEFAULT_COOKIE_ATTRIBUTE |
static String |
DEFAULT_COOKIE_PARAMETER |
protected String |
requestCookieParameterName |
attributeName, DEFAULT_PARAMETER, DEFAULT_REQUESTONLY_PARAMETER, DEFAULT_SESSION_ATTRIBUTE, LOG, parameterName, requestOnlyParameterName
Constructor and Description |
---|
I18nInterceptor() |
Modifier and Type | Method and Description |
---|---|
String |
intercept(ActionInvocation invocation)
Override to handle interception
|
protected Locale |
readStoredLocale(ActionInvocation invocation,
Map<String,Object> session)
Reads the locale from the session, and if not found from the
current invocation (=browser)
|
void |
setRequestCookieParameterName(String requestCookieParameterName) |
protected Locale |
storeLocale(ActionInvocation invocation,
Locale locale,
String storage)
Store the locale to the chosen storage, like f.
|
findLocaleParameter, getLocaleFromParam, readStoredLocalFromCurrentInvocation, readStoredLocalFromSession, saveLocale, setAttributeName, setParameterName, setRequestOnlyParameterName
destroy, init
public static final String DEFAULT_COOKIE_ATTRIBUTE
public static final String COOKIE_STORAGE
public static final String DEFAULT_COOKIE_PARAMETER
protected String requestCookieParameterName
public String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class I18nInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.protected Locale storeLocale(ActionInvocation invocation, Locale locale, String storage)
I18nInterceptor
storeLocale
in class I18nInterceptor
invocation
- the action invocationlocale
- the locale to storestorage
- the place to store this locale (like Storage.SESSSION.toString())protected Locale readStoredLocale(ActionInvocation invocation, Map<String,Object> session)
I18nInterceptor
readStoredLocale
in class I18nInterceptor
invocation
- the current invocationsession
- the current sessionpublic void setRequestCookieParameterName(String requestCookieParameterName)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.