You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Reurings <ma...@windgazer.nl> on 2010/02/11 11:44:48 UTC
T5 URLRewriterRule and ThreadLocale ordering
Hi Guys,
I'm trying to achieve several effects in the same application all
applied to the url and I'm using two URLRewriterRules to do so (Actually
4, 2 inbound and 2 outbound):
1) Store an application-wide value in the url, much like the ThreadLocale
2) Translate the first level of navigation based on the Locale
However, I found that I had some problems in getting this to work
because I cannot find out how to change my rules to run after
ThreadLocale has been applied. I would, for instance like my url to become:
.../locale/globalvalue/translated
Currently my url would look like this:
.../globalvalue/locale/translated
I could cheat by detecting if threadlocale has been applied and ifso,
inserting my global var after the threadlocale, but this 'feels wrong'.
Also, because my rules always fire before ThreadLocale I had to parse
the locale from the url myself, I can't rely on ThreadLocale during my
translation :( It appears as if ThreadLocale is somehow hacked into the
url-creation process and completely bypassing the URLRewriters! Any tips?
Cheers,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 URLRewriterRule and ThreadLocale ordering
Posted by Martin Reurings <ma...@windgazer.nl>.
Thiago H. de Paula Figueiredo wrote:
> On Thu, 11 Feb 2010 08:44:48 -0200, Martin Reurings
> <ma...@windgazer.nl> wrote:
>
>> Hi Guys,
>
> Hi!
Do you ever sleep?
>
>> I could cheat by detecting if threadlocale has been applied and ifso,
>> inserting my global var after the threadlocale, but this 'feels wrong'.
>
> Reading the sources, I've found that ThreadLocale is set when the
> ComponentEventLinkEncoder methods decodePageRenderRequest() and
> decodeComponentEventRequest() are invoked. I suggest you to invoke one
> of this methods before checking the ThreadLocale. Without invoking
> them explicitly, they're only invoked by dispatchers, something that
> happens after the URL rewriter request filter invocation.
>
> Please try it and post the results. :)
>
Ok, at least for detecting the locale this works! Now I'm using the
ThreadLocale again and that makes me feel better :) As far as the order
in which things are added to the url, I would still have to 'detect' the
presence of the locale in the outbound and insert my global variable
after the locale, if I want the locale to be the first option...
As a POC everything now works well enough. I added a note to my source
to look for the dispatcher chain if I want to reorder ThreadLocale /
GlobalVar :)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 URLRewriterRule and ThreadLocale ordering
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 11 Feb 2010 08:44:48 -0200, Martin Reurings <ma...@windgazer.nl>
wrote:
> Hi Guys,
Hi!
> I could cheat by detecting if threadlocale has been applied and ifso,
> inserting my global var after the threadlocale, but this 'feels wrong'.
Reading the sources, I've found that ThreadLocale is set when the
ComponentEventLinkEncoder methods decodePageRenderRequest() and
decodeComponentEventRequest() are invoked. I suggest you to invoke one of
this methods before checking the ThreadLocale. Without invoking them
explicitly, they're only invoked by dispatchers, something that happens
after the URL rewriter request filter invocation.
Please try it and post the results. :)
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, software architect and developer, 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