> PageRenderRequestParameters decodePageRenderRequest(Request request);
Yikes. Maybe I should wait until the first rev is committed, but this looks intimidating if I just want to append /t5 to the url on the way out and take it off on the way in. Tapestry does some heavy lifting in the ComponentEventLinkEncoder that I don't want to duplicate so instead it looks like I'm going to provide a wrapper for Request with a modified url so I can pass it to ComponentEventLinkEncoder myself... This seems like its going to generate questions on the user list. If I return a value, is the next transformer going to get to run? If so my strategy detailed above isn't going to work if the other transformer also tweaked the link such that it isn't recognizable by Tapestry. I guess that goes both ways, if I modify a link does the next transformer get to modify the link also? Maybe not a requirement but it doesn't look like I'll be able to add/remove request parameters to incoming requests. Josh On Wed, Jun 2, 2010 at 1:29 PM, Howard Lewis Ship <hls...@gmail.com> wrote: > There are probably what you need, from interface Link: > > /** > * Returns the completely unadorned base path. Other methods (such > as {...@link #toURI()}), may append > * an anchor or query parameters. > * > * @since 5.2.0 > */ > String getBasePath(); > > /** > * Creates a copy of this link that has the same parameters, > anchor, and other attributes, but a different > * {...@linkplain #getBasePath() base path}. > * > * @since 5.2.0 > */ > Link copyWithBasePath(String basePath); > > > > Also, the core of the API are a pair of these (the other being for > component event requests): > > @UsesOrderedConfiguration(PageRenderLinkTransformer.class) > public interface PageRenderLinkTransformer > { > /** > * Transforms a page render link. > * > * @param defaultLink > * default Link for this request > * @param parameters > * that define the request > * @return replacement Link, or null > */ > Link transformPageRenderLink(Link defaultLink, > PageRenderRequestParameters parameters); > > /** > * Attempts to decode the page render request, to perform the > opposite action for > * {...@link #transformPageRenderLink(Link, > PageRenderRequestParameters)}. The transformer > * is also responsible for identifying the locale in the request > (as part of the path, or as a > * query parameter or cookie) and setting the locale for the request. > * <p> > * This method will be invoked from the {...@link > PageRenderDispatcher} and a non-null value returned from this method > * will prevent the default {...@link > ComponentEventLinkEncoder#decodePageRenderRequest(Request)} method > from being > * invoked. > * > * @return decoded parameters, or null to proceed normally > * @see LocalizationSetter#setLocaleFromLocaleName(String) > */ > PageRenderRequestParameters decodePageRenderRequest(Request request); > } > > On Wed, Jun 2, 2010 at 1:20 PM, Josh Canfield <joshcanfi...@gmail.com> wrote: >>> I'm starting work on a replacement for the URLRewriter system. >> Hooray! I'm curious to see what you come up with. >> >>> public interface ComponentEventLinkTransformer { >>> Link transformComponentEventLink(Link link, >>> ComponentEventRequestParameters parameters); >>> } >> >> I'd like to not have to re-implement the Link interface if I'm just >> going to change the url or add query parameters. Currently LinkImpl is >> in internal.services so if we could get that moved, or add setters to >> Link or some other strategy. >> >> You've probably only given a piece of the interface, but to be sure: >> For incoming URLs that have been rewritten, does >> ComponentEventRequestParameters make sense? If I've totally remapped >> the URL tapestry is going to have a hard time putting anything useful >> in there. >> >> Josh >> >> On Wed, Jun 2, 2010 at 10:11 AM, Howard Lewis Ship <hls...@gmail.com> wrote: >>> I'm starting work on a replacement for the URLRewriter system. We've >>> previously discussed this, and it will be a non-backwards compatible >>> change (I'm starting by removing the existing URLRewriter and related >>> code). >>> >>> The goals are: >>> >>> * Keep it simple. >>> * Make it possible to easily rewrite the Links created for component >>> event requests, page render requests, and asset requests. >>> >>> I think the basic API will be something like: >>> >>> public interface ComponentEventLinkTransformer { >>> Link transformComponentEventLink(Link link, >>> ComponentEventRequestParameters parameters); >>> } >>> >>> In other words, contributed code has access to the same information as >>> the ComponentEventLinkEncoder service (in fact, this will be invoked >>> from inside CELE). There will be an ordered configuratoin >>> of transformers. A transformer can return a non-null Link to replace >>> the default Link. >>> >>> I have two main use cases: >>> >>> One client wants to easily prefix all Tapestry requests with the >>> virtual folder "t5" (i.e., "/t5/somepage") to make it easier to run >>> the T4 and T5 versions of the application side-by-side. >>> >>> A second client wants some specific control over URLs. They want a >>> certain page to have a number of URLs that would normally map to the >>> Index page instead map to this alternate page, with context. >>> Obfuscated example: they want "/toys", "/games", and "/equipment" to >>> all point to a Search page, each with a different page activation >>> context. The short URL is important to them, but there's already an >>> Index page at "/". >>> >>> >>> -- >>> Howard M. Lewis Ship >>> >>> Creator of Apache Tapestry >>> >>> The source for Tapestry training, mentoring and support. Contact me to >>> learn how I can get you up and productive in Tapestry fast! >>> >>> (971) 678-5210 >>> http://howardlewisship.com >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: dev-h...@tapestry.apache.org >>> >>> >> >> >> >> -- >> -- >> http://www.bodylabgym.com - a private, by appointment only, one-on-one >> health and fitness facility. >> -- >> http://www.ectransition.com - Quality Electronic Cigarettes at a >> reasonable price! >> -- >> TheDailyTube.com. Sign up and get the best new videos on the internet >> delivered fresh to your inbox. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: dev-h...@tapestry.apache.org >> >> > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org > For additional commands, e-mail: dev-h...@tapestry.apache.org > > -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org