Archers and Jazz Musicians James Strachan does something strange…. he actually talks about what Open Sourcing Java means :)
Jul 30

Tapestry and Real URLs? The killer combo

Java, Tech, Web Frameworks Add comments

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!

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'