First of all thanks a lot for all your time and help Lance. I have used your example and worked perfect. I could use the mode to put the css dynamically as I wished. Thanks a lot.
Now my problem is trying to use it in my web app. In tapestry 5.1.0.5 LinkImpl doesn't have getBasePath(), or copyWithBasePath(). You are using them in the ModeComponentEventLinkEncoder. I decided to replace the getBasePath() with toAbsoluteURI() and to create a private method to copy the link passing the link as an attribute but it is imposible to create an instance of LinkImpl from the link because I can't get the values of optimizable, linkforForm, response, optimizer from it. I don't know how to continue from here and if I can replace the basePath with the AbsoluteUri. :( Thanks. On Sat, Mar 31, 2012 at 9:43 AM, Lance Java <lance.j...@googlemail.com>wrote: > I've put together a little demo decorating the ComponentEventLinkEncoder > which I'm sure you could adapt to the deprecated URLRewriter if you prefer > it that way. I've done it in tapestry 5.3 but it could be packported to > tapestry 5.1.0.5 as is. > > I've setup three "special" prefixes for "foo", "bar" and "facebook" > > If you download it and mvn jetty:run then hit > http://localhost:8080/tapestry-sandbox/facebook/modepage1. You will see > that the "mode" environmental is set to "facebook". Click on either of the > links and you will be sent to > http://localhost:8080/tapestry-sandbox/facebook/modepage2< > http://localhost:8080/tapestry-sandbox/facebook/modepage1> > > Likewise, you can try > http://localhost:8080/tapestry-sandbox/foo/modepage1< > http://localhost:8080/tapestry-sandbox/facebook/modepage1> > (mode > = foo) > > Or > http://localhost:8080/tapestry-sandbox/modepage1< > http://localhost:8080/tapestry-sandbox/facebook/modepage1> > (mode > = null) > > > Code is here > https://github.com/uklance/tapestry-sandbox > > Interesting files here > > https://github.com/uklance/tapestry-sandbox/tree/master/src/main/java/com/github/uklance/extras > > > Cheers, > Lance. >