[
https://issues.apache.org/jira/browse/WICKET-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255846#comment-13255846
]
Sven Meier commented on WICKET-4502:
------------------------------------
Can't you just provide a custom UrlRenderer in your RequestCycle:
protected UrlRenderer newUrlRenderer()
{
return new UrlRenderer(getRequest()) {
protected boolean shouldRenderAsFull(final Url url) {
if (pageWithAbsoluteUrlsOnly()){
return true;
} else {
return super.shouldRenderAsFull(url);
}
}
};
}
??
> 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