Possibly, that's a tack I take in a lot of the Tapestry code; passing
the component (actually the ComponentResources) around to gain access
to the component's identity and resources.

I had a lot of trouble with the naming here because from some
perspectives, the ComponentResources IS the component, and your code
is just the icing on the top (something I initially called the
"peer"). Of course, the CR is itself largely a facade around the very
internal ComponentPageElementImpl which is where most of the actual
component logic live ... and so it goes!


On Fri, Feb 6, 2009 at 1:54 PM, Blower, Andy
<andrew.blo...@proquest.co.uk> wrote:
> Not sure how generally useful that would be, but it would solve the problem 
> in an easy way.
>
> Thinking some more about this, would it not be easier to simply pass the 
> messages from the page/component event handler method into the service method 
> that's called to send the email?
>
>> -----Original Message-----
>> From: Howard Lewis Ship [mailto:hls...@gmail.com]
>> Sent: 06 February 2009 21:26
>> To: Tapestry users
>> Subject: Re: Localization in Services
>>
>> Which Messages resource would it inject?
>>
>> I suppose we could add the application's Messages object as an
>> injectable value.
>>
>> On Fri, Feb 6, 2009 at 1:04 PM, Blower, Andy
>> <andrew.blo...@proquest.co.uk> wrote:
>> > I thought that it might be possible to use constructor injection to
>> inject the Messages resource just like you can with Logger. I take it
>> that this is not possible to provide in T5 because of
>> lifecycle/reloading issues then Howard?
>> >
>> >> -----Original Message-----
>> >> From: Howard Lewis Ship [mailto:hls...@gmail.com]
>> >> Sent: 06 February 2009 17:03
>> >> To: Tapestry users
>> >> Subject: Re: Localization in Services
>> >>
>> >> I would go a different route.
>> >>
>> >> Using the ComponentSource service, you can get any page in the
>> >> application as a Component instance.
>> >>
>> >> From that you can get the ComponentResources and from that, the
>> >> Messages object.
>> >>
>> >> Just be aware of the lifecycle: once you boost a Messages instance
>> out
>> >> of the component layer and into the services tier, you are moving it
>> >> out of Tapestry's ability to reload ... in other words, acquire the
>> >> Messages and use it briefly, but don't retain it for longer than a
>> >> single request.
>> >>
>> >> On Fri, Feb 6, 2009 at 7:24 AM, Nicolas Charles
>> <nchar...@linagora.com>
>> >> wrote:
>> >> > Thanks for the tip Roberto, but I didn't succeed into adding the
>> >> > app.properties (or just i can't get the key, i don't know)
>> >> > And it feels strange to use the ValidationMessage for a standart
>> >> message
>> >> >
>> >> > Nick
>> >> >
>> >> > Tapestry Infodea wrote:
>> >> >>
>> >> >> I've forgetten a piece of code, you must contribute the
>> >> >> ValidationMessagesSource in your AppModule:
>> >> >>
>> >> >> public void
>> >> >> contributeValidationMessagesSource(OrderedConfiguration<String>
>> >> >> configuration) {
>> >> >> configuration.add("myprop", "it/infodea/app/internal/myprop");
>> >> >>    }
>> >> >>
>> >> >> and define myprop.properties in it/infodea/app/internal/
>> >> >>
>> >> >> Tapestry Infodea ha scritto:
>> >> >>>
>> >> >>> You can use the ValidationMessagesSource and ThreadLocale
>> services:
>> >> >>>
>> >> >>> ValidationMessagesSource validationMessagesSource;
>> >> >>>
>> >> >>> ThreadLocale threadLocale;
>> >> >>>
>> >> >>> Messages messages =
>> >> >>>
>> >>
>> validationMessagesSource.getValidationMessages(threadLocale.getLocale()
>> >> );
>> >> >>>
>> >> >>> Roberto.
>> >> >>>
>> >> >>>
>> >> >>> Nicolas Charles ha scritto:
>> >> >>>>
>> >> >>>> Hello there,
>> >> >>>>
>> >> >>>> I'm currently struggling with a proper way to use localization
>> in
>> >> a
>> >> >>>> service. My need is fairly simple : i'm using t5-restful-
>> >> webservices from
>> >> >>>> Bill Holloway (by the way great job Bill) to offer REST
>> services.
>> >> >>>> One of my service sends an email. The email is localized. Using
>> >> the
>> >> >>>> Asset for the body of the mail works great for its
>> localization.
>> >> >>>> However the mail's subject is stored in the app.properties...
>> >> >>>>
>> >> >>>> I cannot use the @Inject Messages to retrieve the oh-so-
>> convenient
>> >> >>>> Messages service ( Service id 'Messages' is not defined by any
>> >> module. )
>> >> >>>>
>> >> >>>> Thus my question is :
>> >> >>>> - How can i access to the app.properties from a given service ?
>> >> >>>>
>> >> >>>> The best of the best would be to have a possibility to use
>> >> Messages, but
>> >> >>>> i'm open to any other solution
>> >> >>>>
>> >> >>>> Regards,
>> >> >>>> Nick
>> >> >>>>
>> >> >>>> ---------------------------------------------------------------
>> ---
>> >> ---
>> >> >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> >>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>> ----------------------------------------------------------------
>> ---
>> >> --
>> >> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> >> >>>
>> >> >>
>> >> >>
>> >> >> -----------------------------------------------------------------
>> ---
>> >> -
>> >> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-h...@tapestry.apache.org
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------
>> ---
>> >> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> > For additional commands, e-mail: users-h...@tapestry.apache.org
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Howard M. Lewis Ship
>> >>
>> >> Creator Apache Tapestry and Apache HiveMind
>> >>
>> >> --------------------------------------------------------------------
>> -
>> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> For additional commands, e-mail: users-h...@tapestry.apache.org
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> > For additional commands, e-mail: users-h...@tapestry.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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

Reply via email to