Martin Zabel created WICKET-5163:
------------------------------------

             Summary: Implementing markup loading by extending 
ResourceStreamLocator produces errors with inherited markup
                 Key: WICKET-5163
                 URL: https://issues.apache.org/jira/browse/WICKET-5163
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.7.0
            Reporter: Martin Zabel
            Priority: Minor
         Attachments: inheritanceandmarkuploading.zip

According to Wicket wiki it should be possible to implement 
application-specific markup loading by extending ResourceStreamLocator 
(https://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html).
 The method ResourceStreamLocator#locate returns an IResourceStream. Therefore 
it should be possible to return a custom 
FileResourceStream/StringResourceStream/...

However, whenResourceStreamLocator#locate returns anything else than the 
standard implementation this works only as long as no markup inheritance is 
involved.

When any markup inherited from other markup is loaded, the following stack 
trace is printed:

ERROR - MarkupFactory              - Markup not found: Base markup of inherited 
markup not found. Component class: my.package.HomePage. Enable debug messages 
for org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a 
list of all filenames tried.
org.apache.wicket.markup.MarkupNotFoundException: Base markup of inherited 
markup not found. Component class: my.package.HomePage. Enable debug messages 
for org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a 
list of all filenames tried.
        at 
org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:71)
        at 
org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52)
        at 
org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412)
        at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:448)
        ...

ERROR - DefaultExceptionMapper     - Unexpected error occurred
org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. 
Component is not yet connected to a parent. [Page class = my.package.HomePage, 
id = 0, render count = 1]
        at org.apache.wicket.Component.getMarkup(Component.java:736)
        at org.apache.wicket.Component.internalRender(Component.java:2335)
        at org.apache.wicket.Component.render(Component.java:2298)
        at org.apache.wicket.Page.renderPage(Page.java:1010)
        at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
        ...

The attached source shows this issue. HomePage is loaded without any problem. 
Clicking the link to view InheritingPage makes the error occur. When exactly 
the same html code is loaded from the standard file location there is no 
problem at all.

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

Reply via email to