You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2012/08/06 14:48:02 UTC

[jira] [Resolved] (WICKET-4639) Make RequestUtils.toAbsolutepath generate correct url for BookMarkablePages that haven't had "mountPage" set

     [ https://issues.apache.org/jira/browse/WICKET-4639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4639.
-------------------------------------

    Resolution: Not A Problem

RequestUtils.toAbsolutePath() works fine. The problem is that you pass it incorrect information as current url.
The *current* url is the one in the browser's address bar, while you use the Ajax request's url instead.

Here is the code that fixes your application:

    public final static String toAbsolutePath(final String relativePagePath) {
	    String s = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(relativePagePath));
	    return s;
    }

UrlRendered uses the 'baseUrl' which is the url in the address bar even for Ajax requests.
                
> Make RequestUtils.toAbsolutepath generate correct url for BookMarkablePages that haven't had "mountPage" set
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4639
>                 URL: https://issues.apache.org/jira/browse/WICKET-4639
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.7
>         Environment: Linux x86_64, jetty
>            Reporter: J
>         Attachments: wicketchart.zip
>
>
> When using RequestUtils,toAbsolutePath it will generate bad urls if the page the sent the request was a bookmarkablepage that hadn't been mapped with mountPage.Same example works when mapped with mountPage. I have prepared a quickstart example (Based on code from the wicket cookbook)

--
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