Hey, thank you very much for your support !!
That is the hint I was looking for :)
Now I have implemented the following renderer:
public class MyLinkRenderer extends DefaultLinkRenderer {
protected String constructURL(ILinkComponent component, IRequestCycle
cycle) {
ILink link = component.getLink(cycle) ;
String scheme = component.getScheme() ;
String anchor = component.getAnchor() ;
WebRequest request = cycle.getInfrastructure().getRequest() ;
int httpsPort = request.getServerPort() == 80 ? 443 : 8443 ;
int httpPort = ((request.getServerPort() == 8443) ||
(request.getServerName().equalsIgnoreCase("localhost"))) ? 8080 : 80 ;
if ((null != scheme) && scheme.equalsIgnoreCase("https"))
return link.getURL(scheme, null, httpsPort, anchor, true) ;
return link.getURL("http", null, httpPort, anchor, true) ;
}
}
I noticed, that the problem also exists the other way round :( Once you are
on a https-part, every link on the page is rendered as https (or with the
wrong port when binding scheme to 'http' :(
So there is normally no way back. Therefore I 've changed your code to fit
my needs.
But there is still a problem: hardcoded, static links are also decorated
the wrong way :(
So is there a possibility to set this LinkRenderer as a default ? It is
very annoying to set the renderer in every link, particulary on static ones
:(
Together with some tweaking (injecting the hard-coded ports and hostnames
via hivemind as sets ?) it would by great if Howard could implement an
default renderer to get rid of this problem :)
I will check this 'feature/bug' request link you have mentioned, hoping my
english is good enough :)
Many thanks, again !
Kent Tong
<[EMAIL PROTECTED] An:
[email protected]
rg.mo> Kopie:
Gesendet von: Thema: Re: Question about 'scheme
https' ...
news
<[EMAIL PROTECTED]
ne.org>
02.12.2005
04:14
Bitte
antworten an
"Tapestry
users"
<gs <at> smm.de> writes:
> My local server (Tomcat) ist running on port 8080, https is listening on
> port 8443.
>
> In the border-component there is the following definition:
>
> <component id="loginpage" type="PageLink">
> <binding name="page" value="'Login'"/>
> <binding name="scheme" value="'https'"/>
> </component>
>
> The generated link looks like https://localhost:8080/... .
I'd suggest that you submit a feature request or bug report at
http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10573.
To workaround the problem at hand, try creating a LinkRenderer that
extends the DefaultLinkRenderer and change its constructLink() to
something like:
protected String constructURL(ILinkComponent component, IRequestCycle
cycle)
{
ILink link = component.getLink(cycle);
String scheme = component.getScheme();
String anchor = component.getAnchor();
int port = scheme != null && scheme.equals("https") ? 80 : 0;
return link.getURL(scheme, null, port, anchor, true);
}
Then of course use that LinkRenderer for your PageLink.
--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]