Package org.apache.struts2.interceptor
Class I18nInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.I18nInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
An interceptor that handles setting the locale specified in a session as the locale for the current action request.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classprotected classprotected static interfaceUses to handle reading/storing Locale from/in different locationsprotected classprotected classprotected static enum
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ParameterfindLocaleParameter(ActionInvocation invocation, String parameterName) protected LocalegetLocaleFromParam(String requestedLocale) Creates a Locale object from the request paramprotected I18nInterceptor.LocaleHandlergetLocaleHandler(ActionInvocation invocation) Override this method to use your own implementation ofI18nInterceptor.LocaleHandlerintercept(ActionInvocation invocation) Override to handle interceptionvoidsetAttributeName(String attributeName) voidsetLocaleProviderFactory(LocaleProviderFactory localeProviderFactory) voidsetLocaleStorage(String storageName) voidsetParameterName(String parameterName) voidsetRequestCookieParameterName(String requestCookieParameterName) voidsetRequestOnlyParameterName(String requestOnlyParameterName) voidsetSupportedLocale(String supportedLocale) Sets supported Locales by the applicationprotected voiduseLocale(ActionInvocation invocation, Locale locale) Save the given locale to the ActionInvocation.Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Field Details- 
DEFAULT_SESSION_ATTRIBUTE- See Also:
 
- 
DEFAULT_PARAMETER- See Also:
 
- 
DEFAULT_REQUEST_ONLY_PARAMETER- See Also:
 
- 
DEFAULT_COOKIE_ATTRIBUTE- See Also:
 
- 
DEFAULT_COOKIE_PARAMETER- See Also:
 
- 
parameterName
- 
requestOnlyParameterName
- 
attributeName
- 
requestCookieParameterName
- 
storage
- 
localeProviderFactory
 
- 
- 
Constructor Details- 
I18nInterceptorpublic I18nInterceptor()
 
- 
- 
Method Details- 
setParameterName
- 
setAttributeName
- 
setRequestOnlyParameterName
- 
setRequestCookieParameterName
- 
setLocaleStorage
- 
setSupportedLocaleSets supported Locales by the application- Parameters:
- supportedLocale- a comma separated list of supported Locale
 
- 
setLocaleProviderFactory
- 
interceptDescription copied from class:AbstractInterceptorOverride to handle interception- Specified by:
- interceptin interface- Interceptor
- Specified by:
- interceptin class- AbstractInterceptor
- Parameters:
- invocation- the action invocation
- Returns:
- the return code, either returned from ActionInvocation.invoke(), or from the interceptor itself.
- Throws:
- Exception- any system-level error, as defined in- Action.execute().
 
- 
getLocaleHandlerOverride this method to use your own implementation ofI18nInterceptor.LocaleHandler- Parameters:
- invocation- current action invocation context
- Returns:
- instance of I18nInterceptor.LocaleHandler
 
- 
getLocaleFromParamCreates a Locale object from the request param- Parameters:
- requestedLocale- the parameter from the request
- Returns:
- instance of Localeor null
 
- 
findLocaleParameter
- 
useLocaleSave the given locale to the ActionInvocation.- Parameters:
- invocation- The ActionInvocation.
- locale- The locale to save.
 
 
-