[
https://issues.apache.org/struts/browse/TILES-482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antonio Petrelli closed TILES-482.
----------------------------------
Resolution: Fixed
> Wildcard configuration doesn't work with cascaded attributes
> ------------------------------------------------------------
>
> Key: TILES-482
> URL: https://issues.apache.org/struts/browse/TILES-482
> Project: Tiles
> Issue Type: Bug
> Components: tiles-core
> Affects Versions: 2.1.3, 2.1.4
> Environment: Windows, WAS 6.1, Struts 2
> Reporter: Aris Tzoumas
> Assignee: Antonio Petrelli
> Attachments: 482.patch
>
>
> I found out that when creating a wildcard configuration with a cascade="true"
> attribute inside, this attribute doesn't actualy apply to the actual
> resulting cached configuration.
> Sample configuration xml:
> <definition name="abstract.one" template="/WEB-INF/jsp/one.jsp">
> </definition>
> <definition name="abstract.two" template="/WEB-INF/jsp/two.jsp">
> </definition>
> <definition name="*.*.*" extends="abstract.one">
> <put-attribute name="abstract.one-param1" value="/WEB-INF/jsp/param1.jsp" />
> <put-attribute name="abstract.one-param2" value="abstract.two" />
> <put-attribute name="abstract.two-param1"
> value="/WEB-INF/jsp/{1}/{2}/{3}.jsp" cascade="true"/>
> </definition>
> Looking at the source code, the problem seems to be in method
> replaceDefinition of class CachingLocaleUrlDefinitionDAO.java
> If I replace the method to the following, everything is ok:
> protected Definition replaceDefinition(Definition d, String name,
> Map<Integer, String> vars) {
> Definition nudef = new Definition();
> nudef.setExtends(replace(d.getExtends(), vars));
> nudef.setName(name);
> nudef.setPreparer(replace(d.getPreparer(), vars));
> nudef.setTemplateAttribute(replaceVarsInAttribute(d
> .getTemplateAttribute(), vars));
> Set<String> localAttributeNames = d.getLocalAttributeNames();
> if (localAttributeNames != null && !localAttributeNames.isEmpty()) {
> for (String attributeName : localAttributeNames) {
> Attribute attr = d.getLocalAttribute(attributeName);
> Attribute nuattr = replaceVarsInAttribute(attr, vars);
> nudef.putAttribute(replace(attributeName, vars), nuattr);
> }
> }
>
> /** this is my hack! **/
> Set<String> cascadedAttributeNames = d.getCascadedAttributeNames();
> if (cascadedAttributeNames != null &&
> !cascadedAttributeNames.isEmpty()) {
> for (String attributeName : cascadedAttributeNames) {
> Attribute attr = d.getCascadedAttribute(attributeName);
> Attribute nuattr = replaceVarsInAttribute(attr, vars);
> nudef.putAttribute(replace(attributeName, vars), nuattr,
> true);
> }
> }
> return nudef;
> }
> Please fix it in next version of Tiles 2.1.x. I don't know if this is working
> in Tiles 2.2.x, since there is no Struts plugin for Tiles 2.2.x yet.... (who
> should I blame?)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.