Hi all,

I am using Tapestry 5.1.0.5 for a facebook application (which means that the Tapestry application is rendered within an iframe provided by facebook). Facebook applications have URLs of the form:

http://apps.facebook.com/appName

Facebook will adjust the iframe source attribute so that

http://apps.facebook.com/appName/invite

will render http://myserver.com/myapp/invite within the iframe (supposing http://myserver.com/myapp/ is my tapestry application).

For each PageLink that is rendered, I want to rewrite the URL so that I can reload the top document using a URL in

http://apps.facebook.com/appName/invite

format, instead of a relative URL that is normally rendered.

I have tried using a URLRewriterRule, however this will only rewrite the serverName & path elements. After some work to track down where I can render my own base URL (credits to Uli from #tapestry for helping!) it seemed I had to override the default RequestSecurityManager service so that I would provide an absolute base URL of "http://apps.facebook.com"; to page links. After many tries, I still have PageLinks' being rendered with my local server's port (my tomcat is running on port 8084), as follows:

http://apps.facebook.com:8084/appName/invite

I have tracked down this issue to the following method in ComponentEventLinkEncoderMethodAdvice:

String fullUrl(Request request)
   {

       String protocol = request.isSecure() ? "https://"; : "http://";;
       final int localPort = httpServletRequest.getLocalPort();
       String port = localPort == 80 ? "" : ":" + localPort;

       final String path = request.getPath();
       final String contextPath = request.getContextPath();
return String.format("%s%s%s%s%s", protocol, request.getServerName(), port, contextPath, path);

   }

which seems to ignore the base URL provided by the BaseURLSource service (or any other service...) and assumes that httpServletRequest.getLocalPort() is fine.

Could you please advise if there is any way to achieve rewriting the port in Tapestry as is or should I file a bug on the issue?

Many thanks in advance,
Vassilis


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to