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 (Created) (JIRA)" <ji...@apache.org> on 2012/04/17 14:06:16 UTC

[jira] [Created] (WICKET-4502) Make it easier to produce a page with links with absolute urls

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

        

[jira] [Commented] (WICKET-4502) Make it easier to produce a page with links with absolute urls

Posted by "Sven Meier (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Commented] (WICKET-4502) Make it easier to produce a page with links with absolute urls

Posted by "Martin Grigorov (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Resolved] (WICKET-4502) Make it easier to produce a page with links with absolute urls

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4502.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.7
                   6.0.0-RC1
         Assignee: Martin Grigorov

Solved by removing 'final' from the class signature.
                
> 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
>            Assignee: Martin Grigorov
>             Fix For: 6.0.0-RC1, 1.5.7
>
>
> 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