You need to inject ComponentMessagesSource
which has provides a
Messages getMessages(IComponent component)

The problem is that you have to provide a component to that method,
since that's how the correct resource bundle and also the correct
locale (component.getPage().getLocale() is used ) is identified

This ties your service to tapestry classes and also generally means
that you'll have
to have an active web request (i.e. your service won't be able to
function if it's
not directly triggered from a page or component call)

So,
1) I'd suggest (if possible) building the message at the web layer -
so, instead of
having your service return a message, have it return a message key (and perhaps
the message arguments).
2) if you dont mind tying to Tapestry and the service is called
directly by a component
pass the Message object as a parameter.


On Jan 29, 2008 12:31 AM, Paul Stanton <[EMAIL PROTECTED]> wrote:
> anyone?
>
>
> Paul Stanton wrote:
> > Hi All,
> >
> > I have a service which does not have access to the request cycle etc
> > however I need to use the same messages used for the tapestry
> > components, preferrably from the same Object/Service as the one
> > available to pages. I've tried creating a setter method for the
> > service but it isn't populated by hivemind.
> >
> >    public void setMessages(Messages messages)
> >    {
> >        this.messages = messages;
> >    }
> >
> > Any suggestions?
> >
> > Thanks, Paul.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to