Hi George, is there a convincing reason to use the same page for these two URLs? To get the same end result with tapestry-routing ( http://tynamo.org/tapestry-routing+guide), I'd create two pages and annotate them like so:
@At("/{0}") public class Profile {...} @At("/{0}/{1}") public class AboutProfile {...} Kalle On Mon, Nov 17, 2014 at 6:08 AM, 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. > > I'll look into a second level cache as that seems to be a better solution > than what I came up with, for the time being if a page contained a package > or existed in the root, I just ignored it and skipped the query. > > Where I found things to get very tricky was with the request parameters and > additional pages. Example > > Original > domain.com/profile/profiledomain?make=ford > domain.com/profile/about-us/profiledomain > > profiledomain being the dynamic context > > Rewrite to > domain/profiledomain?make=ford > domain/profiledomain/about-us > > 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 > > I'll post the rewrite rule later tonight, if you have a moment I'd like > you take a look to be sure I don't end up shooting myself in the foot long > term. > > Thiago as always, thank you very much. > > > > > On Mon, Nov 17, 2014 at 6:04 AM, Thiago H de Paula Figueiredo < > thiag...@gmail.com> wrote: > > > On Sat, 15 Nov 2014 00:56:58 -0200, George Christman < > > gchrist...@cardaddy.com> wrote: > > > > Example domain.com/profile/profiledomain > >> to > >> domain.com/profile > >> > > > > I do stuff very similar to this in Eloquentia ( > > https://github.com/thiagohp/eloquentia). See > https://github.com/thiagohp/ > > eloquentia/tree/master/src/main/java/br/com/arsmachina/ > > eloquentia/tapestry/urlrewriting. I'm using tapestry-url-rewriter 2.0.0 > > for incoming URLs and PageRenderLinkTransformer for outgoing ones. > > > > Now I was able to get it to work with this code, but it's a really bad > >> way of doing it do to the fact a query would take place on every single > >> page in the app. > >> > > > > It's not a bad way actually, specially if you use some kind of cache on > > the query results. You can configure Hibernate to use a second-level > cache. > > In addition, Tapestry 5.4's tapestry-ioc-jcache + some JCache > > implementation can help you with that in T-IoC level. > > > > So other than ignoring every package and page, how else could I > >> dynamically do this? > >> > > > > I'm not sure how else you can do that. > > > > -- > > 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 >