On Thu, Jun 30, 2011 at 3:14 PM, Nillehammer
<tapestry.nilleham...@winfonet.eu> wrote:
> Hi List,
>
> if Tapestry recieves a request that does not contain the locale at the
> beginning of the uri, it will determine the desired locale from the request
> headers and send the respond. The PersistentLocale will not be set.
>
> In that case I want to set the PersistentLocale and send a redirect to the
> client to ensure the locale is allways part of every uri. My first idea was
> to implement a RequestFilter. But it turned out, even if the uri contained
> the locale, the PersistentLocale was not set (yet). Same with Dispatchers.
>
> I dug into Tapestry's source code and found out that PersistentLocale is set
> in ComponentEventLinkEncoder's decode methods. From that I judged I would
> only have access to PersistentLocale from within pages or components.
>
> So I implemented an abstract BasePage that checks PersistentLocale.isSet in
> its onActivate method and sends the redirect, if necessary. All my pages
> inherit from BasePage,
>

In Tapestry, any time your solution involves creating a base page, you
are probably off on the wrong track.

The best place to add cross-cutting concerns such as you describe is
by contributing a filter into the ComponentRequestHandler service
pipeline. This is how I do page flow, security, and many other things.

> Now I am wondering, if there is a smarter approach?
>
> Thanks in advance,
> nillehammer
>
> --
> http://www.winfonet.eu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to