Even though I've tried what you suggested, Thiago, your question really
pointed me in the right direction, both the custom binding and the aliasing
of the ComponentMessagesSource work now! :)

I made a couple of mistakes along the way:

1. I assumed the Request service is per-thread. It obviously isn't.

2. I injected my UserContainer service, a per-thread wrapper service to get
my User object from ApplicationStateManager, into my bindingfactory. But in
the newBinding method, I passsed userContainer.getUser() to the Binding,
causing the per-thread behaviour to be broken. When I pass the UserContainer
service to the Binding instead, it works.

3. Most importantly, I approached this problem the stupid and complex way.
The natural way to start is of course like you said, Thiago, by creating a
per-thread service that retrieves text from the database. And go on from
there by using this service in a clean and tidy fashion. I did the opposite,
making a mess of everything. As always. Good thing I have some smart people
who can ask me the stupid questions :)

Thank you!

Inge

On Thu, Feb 26, 2009 at 10:04 PM, Inge Solvoll <inge.tapes...@gmail.com>wrote:

> I tried similar things. But now you set me up with something that I think
> is a good idea :) I'll try it and report back what I did and whether I
> succeeded.
>
> In spite of all the struggling, I'm really beginning to see the fun in this
> IOC business :)
>
>
> On Thu, Feb 26, 2009 at 9:14 PM, Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> Em Thu, 26 Feb 2009 16:57:08 -0300, Inge Solvoll <inge.tapes...@gmail.com>
>> escreveu:
>>
>>  The problem is, I can't seem to find a way to make my binding or
>>> bindingfactory act as a per-thread service. Is there any way to do that?
>>>
>>
>> What about your binding or binding factory using a per-thread service that
>> pulls the messages from the DB? ;)
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>

Reply via email to