You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Thiago H. de Paula Figueiredo" <th...@gmail.com> on 2009/03/05 03:06:33 UTC

Adding URL rewriting to Tapestry

Hi!

As a new committer, I would like to hear what do you think about this.
I'm working on a project that needs some URL rewriting. What about adding  
this to Tapestry? I've been playing with it and it seems easy enough to be  
my first issue in Tapestry. One example of open source's "scratching your  
own itch". :) As I'll have little free time this month to work with other  
issues, I guess this is good way to finally start contributing to  
Tapestry, instead of just participating in the mailing list.

Any thoughts? Does Tapestry really needs URL rewriting or should it be  
developed elsewhere (in Ars Machina Project, for example)?

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 09 Mar 2009 20:01:33 -0300, Howard Lewis Ship <hl...@gmail.com>  
escreveu:

> I think to handle this you're going to see longer start up times, as
> Tapestry will have to load all page classes to look for the
> annotations that can drive this.  It's something I've been avoiding.

My plans is to accomplish that without scanning all page classes, maybe  
just some property files (app.properties and its localized versions).  
Tapestry itself (RequestFilters, Dispatchers) wouldn't even know that this  
URL i18n is being done. I just don't know yet how I would i18nalize the  
link creation, but maybe decorating LinkFactory will do the trick.

I've already finished the initial URL rewriting infrastructure (without  
URL i18n). I just need to write the documentation.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by Howard Lewis Ship <hl...@gmail.com>.
I think to handle this you're going to see longer start up times, as
Tapestry will have to load all page classes to look for the
annotations that can drive this.  It's something I've been avoiding.

On Fri, Mar 6, 2009 at 9:46 PM, Alex Kotchnev <ak...@gmail.com> wrote:
> Thiago,
>  a HUGE +1 from me.
>
> It would be great if there is a way to provide per-locale translations  of
> page names : e.g.
>
> En : /money
> BG : /pari
> ru : /dengi
>
> or something similar. The point of "nice URLs" works great for english
> speaking audiences (or rather, for audiences in the same language as the
> implementor), but I hate the idea that I have to teach my bulgarian users to
> remember english names (or alternatively, my english speaking users would
> need to learn the Bulgarian names) for the "nice" URLs just doesn't work
> well.
>
> Cheers,
>
> Alex Kotchnev
>
>
>
> On Thu, Mar 5, 2009 at 12:35 PM, Thiago H. de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
>> JIRA filed: https://issues.apache.org/jira/browse/TAP5-557
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by Alex Kotchnev <ak...@gmail.com>.
Thiago,
  a HUGE +1 from me.

It would be great if there is a way to provide per-locale translations  of
page names : e.g.

En : /money
BG : /pari
ru : /dengi

or something similar. The point of "nice URLs" works great for english
speaking audiences (or rather, for audiences in the same language as the
implementor), but I hate the idea that I have to teach my bulgarian users to
remember english names (or alternatively, my english speaking users would
need to learn the Bulgarian names) for the "nice" URLs just doesn't work
well.

Cheers,

Alex Kotchnev



On Thu, Mar 5, 2009 at 12:35 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> JIRA filed: https://issues.apache.org/jira/browse/TAP5-557
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Adding URL rewriting to Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
JIRA filed: https://issues.apache.org/jira/browse/TAP5-557

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, Mar 5, 2009 at 5:05 AM, Markus Joschko <ma...@gmail.com> wrote:
> Hi Thiago,

Hi Markus!

> I think what Tapestry needs is not necessarily a complete URL
> rewriting logic but a way to abstract from package and class names in
> the path.

Well, in my case, I need some simple URL rewriting something like
login.domain.com -> domain.com/page/login. I had not thought about
using it for internationalization of URL, but this a great idea.
Thanks Markus and Kristian! I'm planning to to generic rewriting first
and add URL i18n shortly after.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 05 Mar 2009 12:50:40 -0300, Andreas Andreou <an...@di.uoa.gr>  
escreveu:

> Hi!

Hi, Andreas!

> The reason i'm writing down those:
> 1) perhaps those links provide inspiration
> 2) trying to make sure we're not reinventing the wheel - or at least if  
> we do, there's a terribly good reason for it!
> 3) I love messing with urls too - if indeed there's scope for this
> project, i'll help

Thank you! I agree with you. I've taken a look at the provided links, but  
I intend to implement it in a very Tapestry-IoC way, providing a simple  
common infrastructure over with we can build simple solutions for simple  
problems and sophisticated solutions for sophisticated problems. :) All  
this always supporting the option of implementing the rewriting logic  
yourself in code. By the way, this is exactly the starting point I  
envision. ;)

> PS Having a strong relationship between page and URL makes sense, but
> i can accept that in practice ppl may want/need to bend this  
> relationship - a rewrite
> engine will help them do just that!

I like this relationship because it makes error logs and bug fixing easy.  
You don't have to dive in your whole code: you know where the problem is  
(or at least where it ultimately happened and then you have a starting  
point to find out what happened).

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by Andreas Andreou <an...@di.uoa.gr>.
Hi!
Inspired by jsr311's UriTemplate annotation
(https://jsr311.dev.java.net/releases/0.2/javax/ws/rs/UriTemplate.html)
I had once set out to do something similar for T4
(http://tacos.sourceforge.net/tacos4.1/tacos-annotations/rest.html)

It worked fine though i never got to supporting stuff like
@UriTemplate("${car.id}")
(which is not that difficult to do) mainly due to the rewrite filter found at
http://tuckey.org/urlrewrite/ which is easy to use/configure, keeps
all rules in one place
and even works for jsp

Recently i also came across http://dev.horde.org/routes/manual/index.html but
that's in PHP land :)

The reason i'm writing down those:
1) perhaps those links provide inspiration
2) trying to make sure we're not reinventing the wheel - or at least if we do,
there's a terribly good reason for it!
3) I love messing with urls too - if indeed there's scope for this
project, i'll help

PS Having a strong relationship between page and URL makes sense, but
i can accept that
in practice ppl may want/need to bend this relationship - a rewrite
engine will help them do
just that!


On Thu, Mar 5, 2009 at 2:38 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Thu, Mar 5, 2009 at 8:04 AM, Kristian Marinkovic
> <kr...@porsche.co.at> wrote:
>> hi thiago
>
> Hi!
>
>> +1
>>
>> i have the same problem as described by markus. a fully
>> internationalized web app should also have internationalized
>> urls. not just urls implied by the class names.
>
> I guess I answered it in my last message in this thread. :)
>
>> i'd also wish to have positional parameters that i could set
>> on a per page/link basis. example in german below:
>>
>> @URL("gebrauchtwagen/${car.id}/ausstattung/${equipment.id}")
>> public class CarEquipment
>> {
>> }
>
> If I've undersrtood correctly what you mean, this would break the
> Tapestry philosophy of strong relationship between page and URL,
> including name. Tapestry 4, as far as I can remember, doesn't have
> this strong relationship and Howard thought that that wasn't the best
> way to do it. On the other hand, the URL rewriting could solve at
> least partly what you want. The other part (positional parameters)
> could be solved by using onActivate(EventContext context).
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, Mar 5, 2009 at 8:04 AM, Kristian Marinkovic
<kr...@porsche.co.at> wrote:
> hi thiago

Hi!

> +1
>
> i have the same problem as described by markus. a fully
> internationalized web app should also have internationalized
> urls. not just urls implied by the class names.

I guess I answered it in my last message in this thread. :)

> i'd also wish to have positional parameters that i could set
> on a per page/link basis. example in german below:
>
> @URL("gebrauchtwagen/${car.id}/ausstattung/${equipment.id}")
> public class CarEquipment
> {
> }

If I've undersrtood correctly what you mean, this would break the
Tapestry philosophy of strong relationship between page and URL,
including name. Tapestry 4, as far as I can remember, doesn't have
this strong relationship and Howard thought that that wasn't the best
way to do it. On the other hand, the URL rewriting could solve at
least partly what you want. The other part (positional parameters)
could be solved by using onActivate(EventContext context).

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding URL rewriting to Tapestry

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi thiago

+1

i have the same problem as described by markus. a fully
internationalized web app should also have internationalized 
urls. not just urls implied by the class names.

i'd also wish to have positional parameters that i could set
on a per page/link basis. example in german below:

@URL("gebrauchtwagen/${car.id}/ausstattung/${equipment.id}")
public class CarEquipment
{
}

i think i saw something similar in seam or spring mvc.

g,
kris




Markus Joschko <ma...@gmail.com> 
05.03.2009 09:05
Bitte antworten an
"Tapestry development" <de...@tapestry.apache.org>


An
Tapestry development <de...@tapestry.apache.org>
Kopie

Thema
Re: Adding URL rewriting to Tapestry







Hi Thiago,
I think what Tapestry needs is not necessarily a complete URL
rewriting logic but a way to abstract from package and class names in
the path.
I am located in Europe and have done work for different clients in
different countries and often the clients want to have meaningful URLs
in their native language.

Given that you want to reuse the code you have (english
packages/classnames) you can only solve this by heavy URL rewriting in
apache. I think it should be the responsibility
of tapestry to provide a hook for "translations" of package and
classnames, as only this makes the i18n package complete.

Regards,
 Markus




On Thu, Mar 5, 2009 at 3:06 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Hi!
>
> As a new committer, I would like to hear what do you think about this.
> I'm working on a project that needs some URL rewriting. What about 
adding
> this to Tapestry? I've been playing with it and it seems easy enough to 
be
> my first issue in Tapestry. One example of open source's "scratching 
your
> own itch". :) As I'll have little free time this month to work with 
other
> issues, I guess this is good way to finally start contributing to 
Tapestry,
> instead of just participating in the mailing list.
>
> Any thoughts? Does Tapestry really needs URL rewriting or should it be
> developed elsewhere (in Ars Machina Project, for example)?
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org



Re: Adding URL rewriting to Tapestry

Posted by Markus Joschko <ma...@gmail.com>.
Hi Thiago,
I think what Tapestry needs is not necessarily a complete URL
rewriting logic but a way to abstract from package and class names in
the path.
I am located in Europe and have done work for different clients in
different countries and often the clients want to have meaningful URLs
in their native language.

Given that you want to reuse the code you have (english
packages/classnames) you can only solve this by heavy URL rewriting in
apache. I think it should be the responsibility
of tapestry to provide a hook for "translations" of package and
classnames, as only this makes the i18n package complete.

Regards,
 Markus




On Thu, Mar 5, 2009 at 3:06 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Hi!
>
> As a new committer, I would like to hear what do you think about this.
> I'm working on a project that needs some URL rewriting. What about adding
> this to Tapestry? I've been playing with it and it seems easy enough to be
> my first issue in Tapestry. One example of open source's "scratching your
> own itch". :) As I'll have little free time this month to work with other
> issues, I guess this is good way to finally start contributing to Tapestry,
> instead of just participating in the mailing list.
>
> Any thoughts? Does Tapestry really needs URL rewriting or should it be
> developed elsewhere (in Ars Machina Project, for example)?
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org