6

I am getting following warning with Apche tiles 3 and Spring MVC 4 I does not added any extra configurations for multilingual support but it supporting by default. Can any one help me to disable this option to remove this warning in my site.

    org.apache.tiles.request.locale.PostfixedApplicationResource.
<init> No supported matching language for locale "sw". 
Using file:/opt/apache-tomcat-8.0.35/webapps/ROOT/WEB-INF/tiles/app-core_sw.xml as a non-localized resource path. see TILES-571
Gary Russell
  • 166,535
  • 14
  • 146
  • 179
Rakesh
  • 1,035
  • 1
  • 14
  • 31

2 Answers2

6

You can disable this option by writing your own DefinitionFactory implementation and registering the same in TilesConfigurer.

public class CustomLocaleDefinitionsFactory extends LocaleDefinitionsFactory {

    /** {@inheritDoc} */
    @Override
    public Definition getDefinition(String name, Request tilesContext) {
    Definition retValue;
    Locale locale = null;

    retValue = definitionDao.getDefinition(name, locale);
    if (retValue != null) {
      retValue = new Definition(retValue);
      String parentDefinitionName = retValue.getExtends();
      while (parentDefinitionName != null) {
        Definition parent = definitionDao.getDefinition(parentDefinitionName, locale);
        if (parent == null) {
          throw new NoSuchDefinitionException("Cannot find definition '" + parentDefinitionName
              + "' ancestor of '" + retValue.getName() + "'");
        }
        retValue.inherit(parent);
        parentDefinitionName = parent.getExtends();
      }
    }

    return retValue;
    }
}

And then in register the above definition factor class, in TilesConfigurer in case using spring like this.

TilesConfigurer configurer = new TilesConfigurer();
configurer.setDefinitions(new String[] { "/WEB-INF/layouts/tiles.xml",
    "/WEB-INF/views/**/tiles.xml" });
configurer.setCheckRefresh(true);
configurer.setDefinitionsFactoryClass(CustomLocaleDefinitionsFactory.class);
return configurer;
Nissa
  • 4,636
  • 8
  • 29
  • 37
pradeep ruhil
  • 136
  • 1
  • 8
1

There is a workaround, just disable the log output will do, if you are using spring boot, it is very easy:

logging.level.org.apache.tiles.request.locale.PostfixedApplicationResource=ERROR
Sam YC
  • 10,725
  • 19
  • 102
  • 158