*** The wcm.io Project is closing down this JIRA Instance in favor of GitHub issues. *** Please use the corresponding GitHub projects to report issues - or the mailing list for general discussion.

AEM Injector for CQ i18n fails in non-script context

Description

There is another issue with the injection of the I18n object, when it is injected in models adapted for example from the Request of the Post Servlet. In this case the SlingBindings attribute is not set, since no script resolving is involved. In this case the original request is used, which is the instance of the org.apache.sling.engine.impl.SlingHttpServletRequestImpl3 class. This instance returns the NullResourceBundle, which does not provide any i18n support.

the only workaround I came up with, was to use the resource for adaption instead of request, in this case the AemInjector uses the request from ModelsImplConfiguration service and everything works fine.

As a solution when injecting the I18n object, we might want to try the slingBindings request, then fallback to the one from ModelsImplConfiguration and only then try the original one.

Gliffy Diagrams

Activity

Show:

Stefan Seifert January 14, 2015 at 11:09 AM

[master 25f22e3], version 1.1.1-SNAPSHOT

i've implemented a fix as you proposed by preferring the thread-local provided request in this case, although it is not a perfect solution.
please validate if it helps.

Fixed

Details

Assignee

Reporter

Components

Priority

Created January 14, 2015 at 11:05 AM
Updated May 22, 2015 at 11:39 PM
Resolved January 14, 2015 at 11:09 AM