Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2101

PageLink is inherently non extendable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4-RC2
    • 1.4-RC3
    • wicket
    • None

    Description

      Due to the fact that there is no accessor provided for the private final IPageLink pageLink, there's no way of writing subclasses that would be aware of the pages they are linking to. My particular case is closely related to the annotation based authorization and an enhancement proposal http://issues.apache.org/jira/browse/WICKET-2089. Now, provided that this enhancement (that otherwise needs more look into) won't make it into wicket/wicket-auth-roles (though I am more than convinced that it should), and I would have to put the proposed IAuthorisationStrategy implementation outside core wicket, I would also have to write (copy&paste) my own PageLink that exposes its pageLink member in order to retrieve the page class it is referring to and substitute all occurernces of org.apache.wicket.markup.html.link.PageLink with it in my projects, so that my IAuthorisationStrategy implementation can retrieve the page class the the link is pointing to. Please note, that BokmarkablePageLink, which also is constructed with Page class does expose page class identity via public final Class<? extends Page> getPageClass().

      I suggest that for the sake of keeping the API clean and coherent the method with the same signature as in BookmarkablePageLink should be added to the PageLink.

      public Class<? extends Page> getPageClass()

      { return pageLink.getPageIdentity(); }

      Another question arises - why BookmarkablePageLink is not a subclass of PageLink and why class resolution for those classes differs so much. Wouldn't it be easier to keep the class reference in the BookmarkablePageClass rather than its textual representation and skip all this mumbo-jumbo class resolution. But this is quite another story and OT for this issue.

      Attachments

        1. link.patch
          4 kB
          Dominik Drzewiecki

        Issue Links

          Activity

            People

              ivaynberg Igor Vaynberg
              drzewo Dominik Drzewiecki
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: