You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alberto Lepe <al...@gmail.com> on 2005/04/16 01:38:11 UTC

Multiple domains & calling an ExternalLink

This is not a question... I just want to share what I learned today. 
I wanted to post this because I didn't find enough information about this:

1. If you want to know which class tapestry calls first, then you can
override ApplicationServlet. Just keep in mind that it would not be
easy to send information from there to your BasePage.

You can implement "PageRenderListener" and it "pageBeginRender" method
to do some stuff like reading the Local Host name or the Locale
object, before the page is displayed.

2. To get the Local Host Name (domain name):
domain = cycle.getRequestContext().getRequest().getLocalName();

3. To be able to use the cycle object (if you are not within a
listener or activateExternalPage) you can get it through the method
"getRequestCycle" from the "event" parameter of the  "pageBeginRender"
method.

4. To redirect to a Tapestry's ExternalLink, you can call the method directly:
	Result result = (Result)cycle.getPage("Result");
	result.activateExternalPage(parameters,cycle);

Remember that if you just want to redirect it, you can use: 
throw new PageRedirectException(getRequestCycle().getPage("Result"));

5. If you want to have more than one Home pages (one different to each
domain), create a Home.page with just:

<page-specification class="com.mycompany.tapestry.StartPage" />

you can add some "property-specification" like pesistent, to keep your
theme available.

On the "StartPage.java", just implement "PageRenderListener" and
"IExternalPage", verify the domain name and redirect it to the page
you want to be the Home page.

That's all ... I hope some people could find this information useful. 
If you think I'm wrong on something posted here or there is a better
way to do it, please replay!

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Multiple domains & calling an ExternalLink

Posted by Jer Kah <je...@gmail.com>.
> 4. To redirect to a Tapestry's ExternalLink, you can call the method directly:
>         Result result = (Result)cycle.getPage("Result");
>         result.activateExternalPage(parameters,cycle);
> 
> Remember that if you just want to redirect it, you can use:
> throw new PageRedirectException(getRequestCycle().getPage("Result"));


How can you pass parameters if you throw a PageRedirectException?


Thanks,
  Jer

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org