struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Briers (JIRA)" <>
Subject [jira] [Commented] (WW-4179) Error messages from JakartaMultiPartRequest are not in the correct language
Date Wed, 21 Aug 2013 13:31:52 GMT


Tom Briers commented on WW-4179:

I have been investigating this issue further and was thinking about the following solution
for my application.  The idea is to implement my own DefaultLocaleProvider which would check
to see if it can find a locale in the session of the ActionContext.

The implementation would look as follows:

public class I18nDefaultLocaleProvider
	implements LocaleProvider

	private final static Logger LOG = LoggerFactory.getLogger(I18nDefaultLocaleProvider.class);

	public Locale getLocale()
		ActionContext ctx = ActionContext.getContext();
		if (ctx != null)
			Locale sessionLocale = (Locale) ctx.getSession().get("some constant in the session, might
be the one found in the I18nInterceptor");
			if (sessionLocale != null)
				return sessionLocale;
				return ctx.getLocale();
			if (LOG.isDebugEnabled())
				LOG.debug("Action context not initialized");
			return null;

However, I'm unable to test this because I cannot find any way to override the DefaultLocaleProvider
implementation used by struts2.

_Is there a way to override this?_

Also, since I cannot test this, I'm assuming the ActionContext recovered at this point in
the execution chain already contains the correct context to recover the session.
> Error messages from JakartaMultiPartRequest are not in the correct language
> ---------------------------------------------------------------------------
>                 Key: WW-4179
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions:
>            Reporter: Tom Briers
> When we upload a file that exceeds the `struts.multipart.maxSize` we don't get the message
in the correct language.
> This seems to be due to the fact that the interceptors are executed after the parse method
(including i18n) meaning the correct locale is not yet available.
> Is there a way to fix this or to get around this limitation?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message