They are actually unique pages in the app

profile/profileIndex
profile/about

however while rewriting the page links, I found it easier to just strip off
profile/ rather than having to strip off profile/about/ just to get to the
two context parameters. I'm assuming the total number of pages will
continue to grow, so I was looking for something a bit more dynamic.

What I don't want is

domain.com/profile/about/profiledomain/about-us
domain.com/about/profiledomain/about-us

but rather domain.com/profiledomain/about-us

Example code of how I'm creating the page links.

<t:pagelink page="profile" context="dealerProfile.profileDomain">Profile</t:
pagelink>
< t:pagelink page="profile" context="[dealerProfile.profileDomain,
'about-us']">About-Us</t:pagelink>

public Link transformPageRenderLink( Link defaultLink,
PageRenderRequestParameters parameters) {
    if (defaultLink.getBasePath().contains("/profile")) {
         return new SimpleLink(defaultLink.getBasePath().replace("/profile",
"")) );
    }
return defaultLink;
}

Now I know the links are hard to follow in the template, but I don't know
of a better way to make this as robust as possible in the rewrite rules.
Does Link offer away to get the basePath minus context?

In decoratePageRequest, I just redirect back to the real page profile/about
etc.

Kalle, I'm not familiar with those annotations. I'll have to read up on
them.



On Mon, Nov 17, 2014 at 11:40 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Mon, 17 Nov 2014 12:08:29 -0200, George Christman <
> gchrist...@cardaddy.com> wrote:
>
>  I ended up getting it working over the weekend, but boy does it seem like
>> a hack. I used some of your work to help me get going such as SimpleLink,
>> however I needed the parameters so I needed to complete the class.
>>
>
> Yeah, my SimpleLink is simple because it didn't need to deal with query
> parameters.
>
>  I ended up having to create some strange pagelinks where everything
>> points back to profile.
>> <t:pagelink page="profile"
>> context="dealerProfile.profileDomain">Profile</t:pagelink>
>> <t:pagelink page="profile" context="[dealerProfile.profileDomain,
>> 'about-us']">About-Us</t:pagelink>
>>
>> in the end it looks like this
>> https://www.cardaddy.com/blue-marlin-motors
>> https://www.cardaddy.com/blue-marlin-motors/about-us
>>
>
> You can create the PageLinks to the original pages as long as you have
> outgoing URL rewrite rules covering them. The whole point of URL rewriting
> is to keep everything the same, but just have the URLs different.
>
> If all the pages that need URL rewriting are put in the same package, you
> can take advantage of this.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to