You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Riedel <cr...@googlemail.com> on 2010/04/30 17:20:09 UTC
URLRewriting and tapestry.force-absolute-uris
Hi list,
I just found in Tapestry that there is a nice link-optimization when tapestry.force-absolute-uris=false (the default).
If the initial request is like "http://app/some/path/to/page" any links on that page will be relative to "http://app/some/path/to/". That's ok until the URLRewriting comes in. I want to rewrite the url "http://app/oldpage.do?foo=bar" to "http://app/some/path/to/page".
Now Tapestry generates all links optimized to the rewritten URL, so there might be links to "http://app/page.component:event/smb", which does not exist... Also, locales will not be encoded into links because Tapestry expects them to be there.
I'm curious how to fix that. Switch on "tapestry.force-absolute-uris", patch Tapestry to generate absolute uris in some cases... or maybe there's some feature in the URLRewriter I'm missing?
Thanks!
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: URLRewriting and tapestry.force-absolute-uris
Posted by Steve Eynon <st...@googlemail.com>.
Hi Christian,
If you are just looking to change incoming legacy requests and don't
care about URLs once the user has entered the system, have a look at:
Url Rewrite Filter - http://tuckey.org/urlrewrite/
It's a servlet filter than alters the URL before Tapestry sees it,
allowing you to convert legacy URLs into T5 friendly ones. It supports
Forwards & Redirects, regex and wildcards and I think even lets you
run java code for more complicated transformations.
Steve.
--
Steve Eynon
mobie: (+592) 678 4236
On 4 May 2010 06:08, Christian Riedel <cr...@googlemail.com> wrote:
> Hm... but how should I change the outbound links?
> When I change the inbound request "/legacy.do?show=page" to "/user/page" the outbound links will be "/user/anotherPage" or similar (according to my debugger, while debugging the outbound filter). They are OK, I don't want the user to see the links that are written in the legacy url form, so I don't change them to another format.
> Then the RequestPathOptimizer touches and "breaks" the links. In the outbound filter links to the other pages are like "/user/anotherPage" but the optimizer strips everything in front of the last slash so in the end the result is "/anotherPage".
>
> I cannot perform redirects with the URLRewriter (to change the url in the browser to the rewritten one) and I don't know how to circumvent the RequestPathOptimizer just for those legacy urls. What can I do in the outbound filter so that the user can access the application via a legacy url and gets proper links that are not in the legacy-application's format?
>
> Maybe it's a bug or a new feature, I could open a JIRA if you also can't see a solution :)
>
> Best regards,
> Christian
>
>
> Am 04.05.2010 um 00:34 schrieb Thiago H. de Paula Figueiredo:
>
>> On Fri, 30 Apr 2010 12:20:09 -0300, Christian Riedel <cr...@googlemail.com> wrote:
>>
>>> Hi list,
>>
>> Hi!
>>
>>> Now Tapestry generates all links optimized to the rewritten URL, so there might be links to "http://app/page.component:event/smb", which does not exist... Also, locales will not be encoded into links because Tapestry expects them to be there.
>>
>> When using URL rewriting, almost all the time you have an inbound rule you must write a correspondent outbound one.
>>
>> --
>> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: URLRewriting and tapestry.force-absolute-uris
Posted by Christian Riedel <cr...@googlemail.com>.
Hm... but how should I change the outbound links?
When I change the inbound request "/legacy.do?show=page" to "/user/page" the outbound links will be "/user/anotherPage" or similar (according to my debugger, while debugging the outbound filter). They are OK, I don't want the user to see the links that are written in the legacy url form, so I don't change them to another format.
Then the RequestPathOptimizer touches and "breaks" the links. In the outbound filter links to the other pages are like "/user/anotherPage" but the optimizer strips everything in front of the last slash so in the end the result is "/anotherPage".
I cannot perform redirects with the URLRewriter (to change the url in the browser to the rewritten one) and I don't know how to circumvent the RequestPathOptimizer just for those legacy urls. What can I do in the outbound filter so that the user can access the application via a legacy url and gets proper links that are not in the legacy-application's format?
Maybe it's a bug or a new feature, I could open a JIRA if you also can't see a solution :)
Best regards,
Christian
Am 04.05.2010 um 00:34 schrieb Thiago H. de Paula Figueiredo:
> On Fri, 30 Apr 2010 12:20:09 -0300, Christian Riedel <cr...@googlemail.com> wrote:
>
>> Hi list,
>
> Hi!
>
>> Now Tapestry generates all links optimized to the rewritten URL, so there might be links to "http://app/page.component:event/smb", which does not exist... Also, locales will not be encoded into links because Tapestry expects them to be there.
>
> When using URL rewriting, almost all the time you have an inbound rule you must write a correspondent outbound one.
>
> --
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: URLRewriting and tapestry.force-absolute-uris
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 30 Apr 2010 12:20:09 -0300, Christian Riedel
<cr...@googlemail.com> wrote:
> Hi list,
Hi!
> Now Tapestry generates all links optimized to the rewritten URL, so
> there might be links to "http://app/page.component:event/smb", which
> does not exist... Also, locales will not be encoded into links because
> Tapestry expects them to be there.
When using URL rewriting, almost all the time you have an inbound rule you
must write a correspondent outbound one.
--
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