Markup Inheritance & getVariation(): markup loading (and merging) order depends 
on whether the super constructor adds components or not.
----------------------------------------------------------------------------------------------------------------------------------------

                 Key: WICKET-4361
                 URL: https://issues.apache.org/jira/browse/WICKET-4361
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.4
            Reporter: Jerome Bodis


I have a web page 'ChildPage' that inherits (java/markup) from a 'SuperPage' 
('ChildPage' --> 'SuperPage'). 'ChildPage' now needs to override getVariation() 
to return a variation string, for example "test". The variation string is 
preferably set in the ChildPages constructor, maybe by a PageParameter.

I would expect the following markup: ChildPage_test.html merged with 
SuperPage.html. This is the case, when SuperPage has no component added in its 
constructor. But when SuperPage has a component added in constructor, then I 
get ChildPage.html merged with SuperPage.html.

quickstart "myproject_1.5.4" (wicket 1.5.4) shows:
ChildPage1 inherits from SuperPage1 (no component added)
ChildPage2 inherits from SuperPage2 (label added)

* Click on "load ChildPage1_test.html " -> markup ok: ChildPage1_test.html 
merged with SuperPage1.html 
* Click on "load ChildPage2_test.html " -> markup not ok: ChildPage2.html 
merged with SuperPage2.html  :  expected ChildPage2_test.html merged with 
SuperPage2.html

same with "myproject2_1.4.19" (wicket 1.4.19) works fine!

Here is some debugging output from MarkupCache:
1 : hildPage1 inherits from SuperPage1 (no component added)
child constructor ------> Class=ChildPage1 variationString=test
DEBUG - MarkupCache                - Load markup: 
cacheKey=com.mycompany.ChildPage1_test_en_US.html
DEBUG - MarkupCache                - Loading markup from 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html
DEBUG - AbstractMarkupParser       - The markup file does not have a XML 
declaration prolog with 'encoding' 
attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html.
 It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
DEBUG - WebAppClassLoader          - loaded class com.mycompany.ChildPage1 from 
sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG - MarkupCache                - Load markup: 
cacheKey=com.mycompany.SuperPage1_test_en_US.html
DEBUG - MarkupCache                - Loading markup from 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage1.html
DEBUG - AbstractMarkupParser       - The markup file does not have a XML 
declaration prolog with 'encoding' 
attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage1.html.
 It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
DEBUG - MergedMarkup               - Merge markup: derived markup: 
ChildPage1_test.html; base markup: SuperPage1.html
DEBUG - WebAppClassLoader          - loaded class com.mycompany.SuperPage1 from 
sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG - MergedMarkup               - Merge markup: 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html

2: ChildPage2 inherits from SuperPage2 (label added)
DEBUG - MarkupCache                - Load markup: 
cacheKey=com.mycompany.ChildPage2_en_US.html
DEBUG - MarkupCache                - Loading markup from 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html
DEBUG - AbstractMarkupParser       - The markup file does not have a XML 
declaration prolog with 'encoding' 
attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html.
 It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
DEBUG - WebAppClassLoader          - loaded class com.mycompany.ChildPage2 from 
sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG - MarkupCache                - Load markup: 
cacheKey=com.mycompany.SuperPage2_en_US.html
DEBUG - MarkupCache                - Loading markup from 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage2.html
DEBUG - AbstractMarkupParser       - The markup file does not have a XML 
declaration prolog with 'encoding' 
attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage2.html.
 It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
DEBUG - MergedMarkup               - Merge markup: derived markup: 
ChildPage2.html; base markup: SuperPage2.html
DEBUG - WebAppClassLoader          - loaded class com.mycompany.SuperPage2 from 
sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG - MergedMarkup               - Merge markup: 
file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html
...
child constructor ------> Class=ChildPage2 variationString=test

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to