You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julien Martin <ba...@gmail.com> on 2012/05/07 17:50:16 UTC

Basic question about URL rewriting and Tapestry 5

Hello,

1. I have the following T5 action link:
*<t:actionlink page="ContactUs" context="literal:en"
hreflang="en">en</t:actionlink>*

2. Which translate into the following link:
*http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*

3. Which in turn, when clicked, displays the following URL:
*http://localhost:8080/ume-web/en/contactus*

I am just wondering whether my action links could directly render as in 3.
i.e. avoid the not so pretty URLs such as : (*
http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*)

Is that possible through URL rewriting? Perhaps using Igor Drobiazko's
rewrite module? Can anyone please provide guidelines?

Regards,

Julien Martin.

Re: Basic question about URL rewriting and Tapestry 5

Posted by Cezary Biernacki <ce...@gmail.com>.
In this case you should use PageLink, instead of ActionLink.

Cezary

Re: Basic question about URL rewriting and Tapestry 5

Posted by George Christman <gc...@cardaddy.com>.
Excellent, thanks Thiago. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Basic-question-about-URL-rewriting-and-Tapestry-5-tp5691410p5720444.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 12 Mar 2013 11:21:14 -0300, George Christman  
<gc...@cardaddy.com> wrote:

> Hi Thiago, has there been any progress with implementing the old API?

The source is at https://github.com/thiagohp/tapestry-url-rewriter, but I  
didn't manage to get it in the Maven central repository yet. I haven't  
done much testing yet, but it passes the unit and integration tests. It's  
not an implementation, just an adaption of the old URL rewriting code  
present in Tapestry 5.1 so it can work in 5.3.

-- 
Thiago H. de Paula Figueiredo

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by George Christman <gc...@cardaddy.com>.
Hi Thiago, has there been any progress with implementing the old API?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Basic-question-about-URL-rewriting-and-Tapestry-5-tp5691410p5720436.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Yeah, I was quite dismayed when the old URL Rewriter API disappeared
to make way for the LinkTransformer - it'd be great if something
similar was resurrected!

In the mean time, I'm checking out Lance's suggestion.

Steve.



On 10 May 2012 20:40, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote:
> On Thu, 10 May 2012 08:58:50 -0300, Steve Eynon
> <st...@alienfactory.co.uk> wrote:
>
>> It's just that implementing a LinkTransformer is lot of work and
>> constructing / deconstructing PageRenderRequestParameters from a raw
>> Request is not a simple task.
>> Whereas the external solutions offer a simple search / replace
>> functionality on the url.
>
>
> This could be done easily with the old URL Rewriter API. I'm planning to
> provide it as a separate package soon.
>

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 10 May 2012 08:58:50 -0300, Steve Eynon  
<st...@alienfactory.co.uk> wrote:

> It's just that implementing a LinkTransformer is lot of work and
> constructing / deconstructing PageRenderRequestParameters from a raw
> Request is not a simple task.
> Whereas the external solutions offer a simple search / replace
> functionality on the url.

This could be done easily with the old URL Rewriter API. I'm planning to  
provide it as a separate package soon.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Lance Java <la...@googlemail.com>.
FYI, I was able to do URL rewriting using simple string manipulation by
decorating the ComponentEventLinkEncoder

https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/mode/ModeComponentEventLinkEncoder.java

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Basic-question-about-URL-rewriting-and-Tapestry-5-tp5691410p5700037.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Steve Eynon <st...@alienfactory.co.uk>.
It's just that implementing a LinkTransformer is lot of work and
constructing / deconstructing PageRenderRequestParameters from a raw
Request is not a simple task.

Whereas the external solutions offer a simple search / replace
functionality on the url.

Steve.



On 8 May 2012 19:53, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote:
> May I ask why external solutions to URL rewriting are always suggested when
> Tapestry provides a perfectly good one out-of-the-box and that can take
> advantage of all the Tapestry infrastructure?
>
>
> On Tue, 08 May 2012 07:07:32 -0300, Julien Martin <ba...@gmail.com> wrote:
>
>> Thanks Steve.
>> I was also considering: http://ocpsoft.org/rewrite/
>> Julien.
>>
>> 2012/5/8 Steve Eynon <st...@alienfactory.co.uk>
>>
>>> I find Tuckey's Url Rewrite Filter a good option for simple rewrites:
>>>
>>> http://www.tuckey.org/urlrewrite/
>>>
>>> Steve.
>>> --
>>> Steve Eynon
>>> -------------------------------
>>> "If at first you don't succeed,
>>>   so much for skydiving!"
>>>
>>>
>>>
>>> On 8 May 2012 04:23, Julien Martin <ba...@gmail.com> wrote:
>>> > Thanks Thiago!
>>> >
>>> >
>>> > 2012/5/7 Julien Martin <ba...@gmail.com>
>>> >
>>> >> Thanks Thiago!
>>> >> I was not aware of that.
>>> >> J.
>>> >>
>>> >> 2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>
>>> >>
>>> >> On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com>
>>> >>> wrote:
>>> >>>
>>> >>>  Hi all!
>>> >>>>
>>> >>>
>>> >>> Hi!
>>> >>>
>>> >>>
>>> >>>  @Thiago: My only concern is about SEO optimization. Can you provide
>>> any
>>> >>>> guideline about LinkTransformer usage? I read Igor's blog entry but
>>> >>>> I
>>> am
>>> >>>> still not sure how to use the LinkTransformer for my specific use
>>> case...
>>> >>>>
>>> >>>
>>> >>> For SEO optimization, as far as I know, the event URLs are
>>> >>> irrelevant,
>>> as
>>> >>> the crawlers (bots) follow redirects.
>>> >>>
>>> >>>

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
May I ask why external solutions to URL rewriting are always suggested  
when Tapestry provides a perfectly good one out-of-the-box and that can  
take advantage of all the Tapestry infrastructure?

On Tue, 08 May 2012 07:07:32 -0300, Julien Martin <ba...@gmail.com> wrote:

> Thanks Steve.
> I was also considering: http://ocpsoft.org/rewrite/
> Julien.
>
> 2012/5/8 Steve Eynon <st...@alienfactory.co.uk>
>
>> I find Tuckey's Url Rewrite Filter a good option for simple rewrites:
>>
>> http://www.tuckey.org/urlrewrite/
>>
>> Steve.
>> --
>> Steve Eynon
>> -------------------------------
>> "If at first you don't succeed,
>>    so much for skydiving!"
>>
>>
>>
>> On 8 May 2012 04:23, Julien Martin <ba...@gmail.com> wrote:
>> > Thanks Thiago!
>> >
>> >
>> > 2012/5/7 Julien Martin <ba...@gmail.com>
>> >
>> >> Thanks Thiago!
>> >> I was not aware of that.
>> >> J.
>> >>
>> >> 2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>
>> >>
>> >> On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com>
>> >>> wrote:
>> >>>
>> >>>  Hi all!
>> >>>>
>> >>>
>> >>> Hi!
>> >>>
>> >>>
>> >>>  @Thiago: My only concern is about SEO optimization. Can you provide
>> any
>> >>>> guideline about LinkTransformer usage? I read Igor's blog entry  
>> but I
>> am
>> >>>> still not sure how to use the LinkTransformer for my specific use
>> case...
>> >>>>
>> >>>
>> >>> For SEO optimization, as far as I know, the event URLs are  
>> irrelevant,
>> as
>> >>> the crawlers (bots) follow redirects.
>> >>>
>> >>>
>> >>> --
>> >>> Thiago H. de Paula Figueiredo
>> >>> Independent Java, Apache Tapestry 5 and Hibernate consultant,
>> developer,
>> >>> and instructor
>> >>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> >>> http://www.arsmachina.com.br
>> >>>
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Julien Martin <ba...@gmail.com>.
Thanks Steve.
I was also considering: http://ocpsoft.org/rewrite/
Julien.

2012/5/8 Steve Eynon <st...@alienfactory.co.uk>

> I find Tuckey's Url Rewrite Filter a good option for simple rewrites:
>
> http://www.tuckey.org/urlrewrite/
>
> Steve.
> --
> Steve Eynon
> -------------------------------
> "If at first you don't succeed,
>    so much for skydiving!"
>
>
>
> On 8 May 2012 04:23, Julien Martin <ba...@gmail.com> wrote:
> > Thanks Thiago!
> >
> >
> > 2012/5/7 Julien Martin <ba...@gmail.com>
> >
> >> Thanks Thiago!
> >> I was not aware of that.
> >> J.
> >>
> >> 2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>
> >>
> >> On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com>
> >>> wrote:
> >>>
> >>>  Hi all!
> >>>>
> >>>
> >>> Hi!
> >>>
> >>>
> >>>  @Thiago: My only concern is about SEO optimization. Can you provide
> any
> >>>> guideline about LinkTransformer usage? I read Igor's blog entry but I
> am
> >>>> still not sure how to use the LinkTransformer for my specific use
> case...
> >>>>
> >>>
> >>> For SEO optimization, as far as I know, the event URLs are irrelevant,
> as
> >>> the crawlers (bots) follow redirects.
> >>>
> >>>
> >>> --
> >>> Thiago H. de Paula Figueiredo
> >>> Independent Java, Apache Tapestry 5 and Hibernate consultant,
> developer,
> >>> and instructor
> >>> Owner, Ars Machina Tecnologia da Informação Ltda.
> >>> http://www.arsmachina.com.br
> >>>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Basic question about URL rewriting and Tapestry 5

Posted by Steve Eynon <st...@alienfactory.co.uk>.
I find Tuckey's Url Rewrite Filter a good option for simple rewrites:

http://www.tuckey.org/urlrewrite/

Steve.
--
Steve Eynon
-------------------------------
"If at first you don't succeed,
   so much for skydiving!"



On 8 May 2012 04:23, Julien Martin <ba...@gmail.com> wrote:
> Thanks Thiago!
>
>
> 2012/5/7 Julien Martin <ba...@gmail.com>
>
>> Thanks Thiago!
>> I was not aware of that.
>> J.
>>
>> 2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>
>>
>> On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com>
>>> wrote:
>>>
>>>  Hi all!
>>>>
>>>
>>> Hi!
>>>
>>>
>>>  @Thiago: My only concern is about SEO optimization. Can you provide any
>>>> guideline about LinkTransformer usage? I read Igor's blog entry but I am
>>>> still not sure how to use the LinkTransformer for my specific use case...
>>>>
>>>
>>> For SEO optimization, as far as I know, the event URLs are irrelevant, as
>>> the crawlers (bots) follow redirects.
>>>
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>>> and instructor
>>> Owner, Ars Machina Tecnologia da Informação Ltda.
>>> http://www.arsmachina.com.br
>>>
>>
>>

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Julien Martin <ba...@gmail.com>.
Thanks Thiago!


2012/5/7 Julien Martin <ba...@gmail.com>

> Thanks Thiago!
> I was not aware of that.
> J.
>
> 2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>
>
> On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com>
>> wrote:
>>
>>  Hi all!
>>>
>>
>> Hi!
>>
>>
>>  @Thiago: My only concern is about SEO optimization. Can you provide any
>>> guideline about LinkTransformer usage? I read Igor's blog entry but I am
>>> still not sure how to use the LinkTransformer for my specific use case...
>>>
>>
>> For SEO optimization, as far as I know, the event URLs are irrelevant, as
>> the crawlers (bots) follow redirects.
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>
>

Re: Basic question about URL rewriting and Tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 07 May 2012 14:19:24 -0300, Julien Martin <ba...@gmail.com> wrote:

> Hi all!

Hi!

> @Thiago: My only concern is about SEO optimization. Can you provide any
> guideline about LinkTransformer usage? I read Igor's blog entry but I am
> still not sure how to use the LinkTransformer for my specific use case...

For SEO optimization, as far as I know, the event URLs are irrelevant, as  
the crawlers (bots) follow redirects.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Basic question about URL rewriting and Tapestry 5

Posted by Julien Martin <ba...@gmail.com>.
Hi all!

@Cezary: I can just use a page link as an action is called on the server
side as follows:

@OnEvent(EventConstants.ACTION)
void changeLocale(String language) {
persistentLocale.set(new Locale(language));
}

@Thiago: My only concern is about SEO optimization. Can you provide any
guideline about LinkTransformer usage? I read Igor's blog entry but I am
still not sure how to use the LinkTransformer for my specific use case...

Best regards,

Julien.

2012/5/7 Thiago H. de Paula Figueiredo <th...@gmail.com>

> On Mon, 07 May 2012 12:50:16 -0300, Julien Martin <ba...@gmail.com>
> wrote:
>
>  Hello,
>>
>
> Hi!
>
>
>> 1. I have the following T5 action link:
>> *<t:actionlink page="ContactUs" context="literal:en"
>> hreflang="en">en</t:**actionlink>*
>>
>>
>> 2. Which translate into the following link:
>> *http://localhost:8080/ume-**web/fr/contactus.actionlink_1/**en*<http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*>
>>
>>
>> 3. Which in turn, when clicked, displays the following URL:
>> *http://localhost:8080/ume-**web/en/contactus*<http://localhost:8080/ume-web/en/contactus*>
>>
>>
>> I am just wondering whether my action links could directly render as in 3.
>> i.e. avoid the not so pretty URLs such as : (*
>> http://localhost:8080/ume-web/**fr/contactus.actionlink_1/en*<http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*>
>> )
>>
>>
>> Is that possible through URL rewriting? Perhaps using Igor Drobiazko's
>> rewrite module? Can anyone please provide guidelines?
>>
>
> Event URLs are not supposed to be pretty because it never really remains
> in the browser address bar, as Tapestry does redirect-after-post.
>
> The answer to your question is yes, LinkTransformer can be used to rewrite
> these URLs, but I don't think you should worry about them, just about page
> ones.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>

Re: Basic question about URL rewriting and Tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 07 May 2012 12:50:16 -0300, Julien Martin <ba...@gmail.com> wrote:

> Hello,

Hi!

>
> 1. I have the following T5 action link:
> *<t:actionlink page="ContactUs" context="literal:en"
> hreflang="en">en</t:actionlink>*
>
> 2. Which translate into the following link:
> *http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*
>
> 3. Which in turn, when clicked, displays the following URL:
> *http://localhost:8080/ume-web/en/contactus*
>
> I am just wondering whether my action links could directly render as in  
> 3.
> i.e. avoid the not so pretty URLs such as : (*
> http://localhost:8080/ume-web/fr/contactus.actionlink_1/en*)
>
> Is that possible through URL rewriting? Perhaps using Igor Drobiazko's
> rewrite module? Can anyone please provide guidelines?

Event URLs are not supposed to be pretty because it never really remains  
in the browser address bar, as Tapestry does redirect-after-post.

The answer to your question is yes, LinkTransformer can be used to rewrite  
these URLs, but I don't think you should worry about them, just about page  
ones.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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