Nabi Zamani created TILES-570: --------------------------------- Summary: Init via listeners and configuring DEFINITIONS_CONFIG via context-param does not work as documented Key: TILES-570 URL: https://issues.apache.org/jira/browse/TILES-570 Project: Tiles Issue Type: Bug Components: tiles-core, tiles-servlet Affects Versions: 3.0.1 Reporter: Nabi Zamani
Please see http://tiles.apache.org/tutorial/configuration.html for some docs and go to the section "Load the Tiles listener. Specify it in your web.xml file". Issue 1: The following configuration is invalid because org.apache.tiles.web.startup.TilesListener does not exist anymore: <listener> <listener-class>org.apache.tiles.web.startup.TilesListener</listener-class> </listener> Issue 2: Because of Issue 1 I have chosen to use the org.apache.tiles.web.startup.simple.SimpleTilesListener for starting the Tiles engine (see http://tiles.apache.org/framework/config-reference.html): <listener> <listener-class>org.apache.tiles.web.startup.simple.SimpleTilesListener</listener-class> </listener> According to the docs this should be possible: <context-param> <param-name> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG </param-name> <param-value>/WEB-INF/classes/tiles.xml</param-value> </context-param> But org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG does not exist (it was mentioned to be deprecated in older versions of Tiles!). Issue 3: Because of issue 2 I used org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG: <context-param> <param-name> org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG </param-name> <param-value>/WEB-INF/classes/tiles.xml</param-value> </context-param> But that does also not allow to load the custom tiles.xml file. Issue 4: I checked sources and found this in org.apache.tiles.factory.BasicTilesContainerFactory (tiles-core-3.0.1.jar): /** * Returns a list containing the resources to be parsed. By default, it returns a * list containing the resource at "/WEB-INF/tiles.xml". * @param applicationContext The Tiles application context. * @return The resources. * @since 2.1.1 */ protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { List<ApplicationResource> retValue = new ArrayList<ApplicationResource>(1); retValue.add(applicationContext.getResource("/WEB-INF/tiles.xml")); return retValue; } As you can see "/WEB-INF/tiles.xml" is hard coded. That's why using the context-param has no influence at all. The only valid location is "/WEB-INF/tiles.xml" and that's it. Would be great if this would be fixed in one of the next releases. Also see the docs here: http://tiles.apache.org/config-reference.html#org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG -- 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: http://www.atlassian.com/software/jira