[
https://issues.apache.org/jira/browse/WICKET-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256407#comment-13256407
]
Martin Grigorov commented on WICKET-4502:
-----------------------------------------
I don't like this approach because:
1) I'll have to find out how to implement "pageWithAbsoluteUrlsOnly()".
Probably I'll need custom IRequestCycleListener to track the "target" page
2) IRequestMapper#mapHandler() is resposible to create the Urls. By using
custom UrlRenderer I move this responsibility
The simplest and cleanest solution for me is to remove 'final' from Url class.
Then I can return my custom AbsoluteUrl in #mapHandler().
> Make it easier to produce a page with links with absolute urls
> --------------------------------------------------------------
>
> Key: WICKET-4502
> URL: https://issues.apache.org/jira/browse/WICKET-4502
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.5
> Reporter: Martin Grigorov
>
> 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 ?
--
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