wrong rendering of links when changing scheme binding
-----------------------------------------------------
Key: TAPESTRY-786
URL: http://issues.apache.org/jira/browse/TAPESTRY-786
Project: Tapestry
Type: Bug
Components: Framework
Environment: Tapestry 4b13, Tomcat, Apache
Reporter: Gerald Schoeffel
When a page is rendered after changing the scheme binding, every link on that
page contains 'wrong' portnumbers.
Example:
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/... .
When using a proxy server (Apache 2.x) to get requests to port 80 forwarded
to my container, having https on port 443, the generated link is
https://mydomain:80/.... :(
When fixing the port-part of the link and entering this in the browser, the
page is rendered with all inks on it containing https :(
Links having scheme bound to 'http' are rendered with the wrong port-number
(now the https-port). So there is no way back :(
With the help of Kent Tong (tapestry mailing list) I could implement a
workaround:
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) ;
}
}
Binding this LinkRenderer as the render in PageLink etc. components will work -
but static links, hardcoded on the page will be rendered wrong.
Would be great to get this fixed and/or improved to enter and leave different
schemes easier.
Thank you in advance !
Gerald
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]