Tiles
  1. Tiles
  2. TILES-482

Wildcard configuration doesn't work with cascaded attributes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.1.4
    • Fix Version/s: 2.1.5
    • Component/s: tiles-core
    • Labels:
      None
    • Environment:

      Windows, WAS 6.1, Struts 2

    • Flags:
      Important

      Description

      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?)

      1. 482.patch
        1 kB
        Aris Tzoumas

        Issue Links

          Activity

          Jeff Turner made changes -
          Project Import Mon Feb 01 01:30:28 UTC 2010 [ 1264987828110 ]
          Antonio Petrelli made changes -
          Fix Version/s 2.1.5 [ 21961 ]
          Antonio Petrelli made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Antonio Petrelli made changes -
          Assignee Antonio Petrelli [ brenmcguire ]
          Priority Critical [ 2 ] Major [ 3 ]
          Aris Tzoumas made changes -
          Attachment 482.patch [ 14132 ]
          Antonio Petrelli made changes -
          Field Original Value New Value
          Link This issue relates to TILES-454 [ TILES-454 ]
          Aris Tzoumas created issue -

            People

            • Assignee:
              Antonio Petrelli
              Reporter:
              Aris Tzoumas
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development