[ 
https://issues.apache.org/jira/browse/TILES-570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14335759#comment-14335759
 ] 

Nicolas Le Bas commented on TILES-570:
--------------------------------------

This ticket is still open indeed.

The context-params were deprecated in tiles 2.2, the current best practice is 
to implement your own TilesInitializer. The long term plan is to move 
everything to your favorite IoC container, but progress is slow.

Nevertheless the docs deserve an update.

> 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.1.x, 3.0.1, 3.0.2
>            Reporter: NZa
>              Labels: DEFINITIONS_CONFIG, config,, location,, tiles.xml,
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to