This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Tapestry and Real URLs? The killer combo
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
I am a big fan of Tapestry. One of the only items left on my list of "this bugs me" was the fact that I didn't have the control over the URLs that I want.
I want URLs to say something, and detest any gobble-de-gook. I think it DOES make a difference.
Howard has promised that this feature will be in 3.1, and it looks like someone has done the heavy lifting for him ;)
Identitytheft911.com has written code that allows them to map URLs, so if you go to:
http://www.identitytheft911.com/resolution/crisisresolution.htm
it gets mapped into the normal Tapestry URL:
http://www.identitytheft911.com/app?service=page/crisisresolution
The explanation:
There are 2 parts: generating and interpreting.
To generate the urls, I use custom PageLink and ExternalLink components
that utilize a custom ILink implementation that generate the urls using
the following pattern:
/.htm
The path-to-page-specification is taken from my application specification.
e.g.
specification-path="resolution/CrisisResolution.page"/>
path-to-page-specification = resolution/
page-name = crisisresolution
generated url = /resolution/crisisresolution.htm
Using lower case page names was done at the insistence of my site
developer...
To interpret the urls, I have a custom Tapestry servlet that is mapped
to the url pattern *.htm.
In my service() method, if the url query string contains "sp" (i.e.
Tapestry.PARAMETERS_QUERY_PARAMETER_NAME), then I generate a Tapestry
external link, if not I generate a page link.
Great stuff!