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

Make it easier to produce a page with links with absolute urls

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.5
    • 1.5.7, 6.0.0-beta2
    • wicket
    • None

    Description

      We needed to create a page which links have absolute urls (protocol, host, port included). So I created a simple extension of MountedMapper that makes the relative url returned by super.mapHandler() to an absolute one.
      So far so far but later Wicket uses org.apache.wicket.request.UrlRenderer#shouldRenderAsFull() to decide whether to actually render the url as full (i.e. as absolute) and since the protocol, the host and the port matches with the current request's url attributes it decides to render the url as relative.

      Since Url class is final it is not possible to create a custom AbsoluteUrl which #toString() delegates to #toString(StringMode.FULL).

      I see two solutions:
      1) provide AbsoluteUrl class which is again final and uses StringMode.FULL
      2) add a boolean flag to Url that is used by UrlRenderer#shouldRenderAsFull() so I can force full mode

      Do you have other solutions ?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mgrigorov Martin Tzvetanov Grigorov
            mgrigorov Martin Tzvetanov Grigorov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment