Hi, see http://tuckey.org/urlrewrite/manual/2.6/ (i see they also have a 3.2 version) Just define some outbound-rules (instead of rules) for the cases you're interested, i.e.
<outbound-rule> <from>^/app/category/product/([0-9]+)?venue=([a-z]+)&locale=([a-z]+)$</from> <to>/app/$2/$3/category/product/$1</to> </outbound-rule> On Fri, Feb 6, 2009 at 12:14 AM, xfile80303 <l...@grokers.net> wrote: > > Hi Andreas, > > Oh, please don't mistake me for an expert on T5 by any means. :) I just > don't see how the filter you mention would help with links generated by T5. > > For instance, let's say I put the filter in place, and I give a user the URL > to access the site: > > /app/venue_name/en_US/category/product/UUID (fill in with imaginary actual > values, if you will) > > The filter could strip out the venue_name, locale, whatever and put them as > actual parameters to the URL... something like: > > /app/category/product/UUID?venue=venue_name&locale=en_US > > And the URL would get passed in this way to T5 and the page would render, no > problem. > > However, once on the page, let's say there's a link to another product. > That link URL would be generated by T5 and look something like: > > /app/category/product/UUID2?venue=venue_name&locale=en_US > > and thus, a user will see this, bookmark it, send it in email to friends, > etc. instead of the "nicely" formatted URL that we started with. So the > filter only makes it possible to map "published" URLS to something T5 can > understand, and does not allow us to filter "outgoing" URLs to change them > back to "nice" ones. > > Does it? > > Cheers, > > Levi > > > Andreas Andreou-2 wrote: >> >> I'm really a T5 novice - what i was saying is that if you do find a >> way to have that >> info in the url (nomatter how, even as query params + i'm sure it's >> possible), you >> can use that filter to completely transform the look of the urls ... >> >> On Thu, Feb 5, 2009 at 10:56 PM, xfile80303 <l...@grokers.net> wrote: >>> >>> Thank you Andreas. >>> >>> I'm not sure I understand how this would help me with issue #2 (as >>> defined >>> in my original posting). Can you enlighten me? >>> >>> Cheers, >>> >>> Levi >>> >>> >>> Andreas Andreou-2 wrote: >>>> >>>> An alternative is http://tuckey.org/urlrewrite/ >>>> And since Tapestry always calls the servlet container to encode the url, >>>> urlrewrite will work for both generating urls (to output in html) and >>>> parsing >>>> them (incoming) >>>> >>>> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <l...@grokers.net> wrote: >>>>> >>>>> Hi Thiago, >>>>> >>>>> Thanks for taking the time. I believe I need to do some clarification >>>>> however. >>>>> >>>>> The example URL I mentioned is order specific. Meaning it would not >>>>> make >>>>> sense to have the venu_name (or others of these URL parameters) to be >>>>> at >>>>> the >>>>> end of the URL. They need to go into the URL before the page name >>>>> structure >>>>> in order to be purposeful. >>>>> >>>>> Cheers, >>>>> >>>>> Levi >>>>> >>>>> >>>>> Thiago H. de Paula Figueiredo wrote: >>>>>> >>>>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <l...@grokers.net> >>>>>> escreveu: >>>>>> >>>>>>> Greetings all, >>>>>> >>>>>> Hello! :) >>>>>> >>>>>>> Specifically, I would like to manipulate the URLs such that I can >>>>>>> have >>>>>>> "nice" RESTful style URLs which feed information into the page >>>>>>> ultimately >>>>>>> being rendered. >>>>>> >>>>>> Tapestry is incredibly RESTful, so I guess you don't have to do much >>>>>> to >>>>>> accomplish what you want. :) >>>>>> >>>>>>> For example: >>>>>>> /app/venue_name/en_US/category/product/UUID >>>>>>> where product would be the rendering page, UUID could be the >>>>>>> activation >>>>>>> context (which, if I understand correctly T5 will handle already). >>>>>>> However, the "venue_name" and locale are not actual pages and are >>>>>>> simply >>>>>>> information which is to be gleaned from the URL and passed to the >>>>>>> page >>>>>>> so it can render as specified. >>>>>> >>>>>> All you need to do is to ignore the venue_name and locale parameters. >>>>>> thedailytube.com, a website created by some guy in this list I always >>>>>> forget the name (I'm sorry . . .), does what you need in the video >>>>>> pages. >>>>>> Look at this URL: >>>>>> >>>>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix >>>>>> >>>>>> The video page uses the first parameter (15794) as the id of the video >>>>>> to >>>>>> be shown. The second parameter is there just for search engine >>>>>> purposes. >>>>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives >>>>>> you >>>>>> exactly the same page as the original URL. ;) >>>>>> >>>>>>> As other posts have suggested, it would seem to me that any >>>>>>> manipulation >>>>>>> of the URL would have to happen in such a way that Tapestry would >>>>>>> properly 1) parse these URL "parameters" and pass them into the >>>>>>> system >>>>>>> for use by the >>>>>>> page, >>>>>> >>>>>> One advice is to use EventContext. It is a little hard to find in the >>>>>> documentation (EventContext section in >>>>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event >>>>>> handler method, including onActivate(), can have a single EventContext >>>>>> parameter. It provides you two methods: one with the parameter count, >>>>>> other that returns the value of the n-th parameter. Having an >>>>>> onActivate(EventContext context) method makes it really easy to deal >>>>>> with >>>>>> different parameters in the activation context, even optional >>>>>> parameters. >>>>>> >>>>>> >>>>>> >>>>>> and 2) understand these "parameters" would need to be in Tapestry >>>>>>> generated links to preserve this data from link to link (page to >>>>>>> page). >>>>>> >>>>>>> There has been mention of using a RequestFilter or a Dispatcher to do >>>>>>> this, but I have two concerns with this: 1) I am not sure how I would >>>>>>> modify the Request (at all?) so Tapestry internals would find the >>>>>>> page >>>>>>> to render >>>>>>> (remove the venu_name and locale parameters and let Tapestry locate >>>>>>> the >>>>>>> category/product page) >>>>>> >>>>>> As stated above, you don't need to change the request, just ignore the >>>>>> parameters you don't need. >>>>>> >>>>>>> 2) Even if I was able to modify the Request, how >>>>>>> would I accomplish #2 above, so generated links would contain this >>>>>>> data? >>>>>> >>>>>> That's the hard part here. One solution is to remember to add the >>>>>> parameters in the context of all PageLinks. Remember: the activation >>>>>> context can have parameters that will be ignored. In this case, the >>>>>> activation context would be a List, not a single value Most examples >>>>>> use >>>>>> an id as the activation context, but that's not the only way to do it. >>>>>> A >>>>>> more automated solution could be the decoration of the LinkFactory >>>>>> service >>>>>> to automatically add the parameters. I haven't tested it, though. >>>>>> >>>>>> -- >>>>>> Thiago H. de Paula Figueiredo >>>>>> Independent Java consultant, developer, and instructor >>>>>> http://www.arsmachina.com.br/thiago >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html >>>>> Sent from the Tapestry Users mailing list archive at Nabble.com. >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr >>>> Tapestry / Tacos developer >>>> Open Source / JEE Consulting >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277221.html >>> Sent from the Tapestry Users mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> >> >> >> -- >> Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr >> Tapestry / Tacos developer >> Open Source / JEE Consulting >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> > > -- > View this message in context: > http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277645.html > Sent from the Tapestry Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org