Re: component scope service with injected messages

2011-08-30 Thread Howard Lewis Ship
As a side note: in 5.2 you CAN inject a Messages object at the service layer ... this Messages object provides access to the application's global message catalog (i.e., WEB-INF/app.properties). It's a proxy Messages that internally determines the current Locale and delegates to the correct localiza

Re: component scope service with injected messages

2011-08-30 Thread nillehammer
>> public Object doSomethingUseful(Object someParameter, Messages messages) {...} Yes, exactly In your page/component class: @Inject private Messages messages; @Inject MyService myService; private Object myValue; public final Object getValueFromService() { return this.myService.doSomethingUs

Re: component scope service with injected messages

2011-08-29 Thread Thiago H. de Paula Figueiredo
On Mon, 29 Aug 2011 20:53:00 -0300, Paul Stanton wrote: just injecting messages didn't work when i tried it. Caused by: java.lang.RuntimeException: No service implements the interface org.apache.tapestry5.ioc.Messages. Maybe a 'service' isn't what I'm after, Messages isn't a service. It

Re: component scope service with injected messages

2011-08-29 Thread Paul Stanton
Do you mean I should do the following: public Object doSomethingUseful(Object someParameter, Messages messages) {...} and thereby call: for example? On 30/08/2011 10:14 AM, nillehammer wrote: Don't inject it in the constructor. That isn't possible. Define the Messages as an (additional) par

Re: component scope service with injected messages

2011-08-29 Thread nillehammer
Don't inject it in the constructor. That isn't possible. Define the Messages as an (additional) parameter to your service method. (This is sometimes referred to as method-Injection, a misleading term in my humble opinion). - http://www.winfonet.eu -- View this message in context: http://tapes

Re: component scope service with injected messages

2011-08-29 Thread Paul Stanton
just injecting messages didn't work when i tried it. Caused by: java.lang.RuntimeException: No service implements the interface org.apache.tapestry5.ioc.Messages. at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560) at org.apache.tapestry5.ioc.internal.Ob

Re: component scope service with injected messages

2011-08-24 Thread Steve Eynon
Hi, If you just want messages for your service (as in messages defined in MyService.properties) then, as nillihammer suggests, simply inject a Messages object. This is because Messages is actually an org.apache.tapestry5.ioc.Messages and is defined and utilised by the IOC layer. I believe Tapestr

Re: component scope service with injected messages

2011-08-24 Thread nillehammer
The easiest way is to define your service methods with an additional Messages parameter. This way you can use the Messages within the service methods. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages