Wicket
  1. Wicket
  2. WICKET-5163

Implementing markup loading by extending ResourceStreamLocator produces errors with inherited markup

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.7.0
    • Fix Version/s: 6.8.0, 7.0.0
    • Component/s: wicket
    • Labels:
      None

      Description

      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 the page inherits directly from WebPage.

      When any markup inherited from another page 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.

        Activity

        Martin Zabel created issue -
        Martin Zabel made changes -
        Field Original Value New Value
        Attachment inheritanceandmarkuploading.zip [ 12581075 ]
        Martin Zabel made changes -
        Description 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.
        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 the page inherits directly from WebPage.

        When any markup inherited from another page 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.
        Martin Grigorov made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 6.8.0 [ 12324068 ]
        Fix Version/s 7.0.0 [ 12322958 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Martin Zabel
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development