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/06/21 11:13:44 UTC

[jira] [Commented] (WICKET-4587) URLRenderer renderFullUrl

    [ https://issues.apache.org/jira/browse/WICKET-4587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13398308#comment-13398308 ] 

Martin Grigorov commented on WICKET-4587:
-----------------------------------------

The fix for your app is to replace
final Url url = getRequestCycle().mapUrlFor( getPageClass(), getPageParameters() );

with
final Url url = Url.parse(urlFor( getPageClass(), getPageParameters() ).toString());

I am not sure how to prevent such error cases. Different methods create different things.

urlFor() returns url relative to the current one (the baseUrl). It uses mapUrlFor() internally to get the url that the IRequestMapper would create and then relativizes it agains the baseUrl.

mapUrlFor() returns the plain url that IRequestMapper creates. I'm not sure how useful is it for end users because it returns an url which is relative to the filter path, not against the current url or the context path...


                
> URLRenderer renderFullUrl
> -------------------------
>
>                 Key: WICKET-4587
>                 URL: https://issues.apache.org/jira/browse/WICKET-4587
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>            Reporter: Dirk Forchel
>            Assignee: Martin Grigorov
>         Attachments: quickstart.zip
>
>
> When using the following code to create an absolute url in wicket 1.5.7 from a page class and parameters, there are also duplicate segments in the url. the rendered absolute url is not correct.
> final Url url = RequestCycle.get().mapUrlFor( pageClass, pageParameters );
> final String result = RequestCycle.get().getUrlRenderer().renderFullUrl( url );
> RequestCycle.get().mapUrlFor(..) does not return an "absolute" url (first segment will not be empty).
> See also description in WICKET-4561

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