OK - so I resolved conceptual problem #1:

        String pageName = componentClassResolver.canonicalizePageName(newPath);

        where "newPath" is the manipulated pass (after removing the 
"SomeAccount").


Remains problem #2:  How do I generically pass a parameter in a page URL (that 
the page may or may not care about)?

Any hints?

Thanks so much!
Jochen


On Jan 30, 2012, at 9:50 PM, Jochen Frey wrote:

> Hi!
> 
> I am looking for a clean way to generically rewrite URLs as follows:
> 
> Publicly we want to have an account name to be the first part of the path in 
> URLs like so:  /SomeAccount/settings/page1.  Since (I believe) that in 
> Tapestry I can't bind the first part of the path to a variable,  I would like 
> to rewrite it to something like this: /settings/page1?account=SomeAccount
> 
> I would want it to be a generic rewrite along the lines of "if the path 
> doesn't start with /login then rewrite the url".  The effect would be that 
> what was a path element becomes a variable (whether query variable or context 
> I don't really know or care).
> 
> I have seen Igor's blog post 
> (http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewriting-api/).  I 
> have two conceptual hurdles that I can't overcome and would love some help 
> with:
> 
> After doing the path manipulation (by way of String manipulation), I need to 
> find the Page class by way of a String that looks like "/settings/page1".
> How do I pass newly created variable (account) into the 
> PageRenderRequestParameters (I guess if knew the Java class from step 1, I 
> could check if it implements an interface and if so, typecast it and ask the 
> receiving page to generate a link ... but that wouldn't help much either.
> 
> It's pretty clear to me how I'd have done it in TS 5.1 
> (http://tapestry.apache.org/url-rewriting.html), but URLRewriterRule is not 
> supported any more.
> 
> Alternatively I could roll my own RequestFilter (like the TimingFilter), but 
> it seems there'd have to be a better way?
> 
> Any suggestions?
> 
> Thanks!
> Jochen
> ---
>   joc...@jochenfrey.com
>   +1.415.366.0450
>   @jochen_frey
> 

---
  joc...@jochenfrey.com
  +1.415.366.0450
  @jochen_frey

Reply via email to