I am aware that there is something special about tapestry services/resources such as Request, Messages etc which are only available in the context of a component render.
I need to create a service which makes heavy use of the messages store and is available only in the scope of a component render.
Can someone explain how I can configure this service correctly so that I can create it with the appropriated Messages object each time it is used?
eg (i know this wouldn’t work):
public class MyServiceImpl
{
@Inject private Messages messages;
@Override
public String getSomeMessage(Object someParameter)
{
...
}
}
and then i could use it like so:
public class MyComponent
{
@Inject
@Parameter
private MyService myService;
}
tml:
<p>${myService.getSomeMessage('someParameter')}</p>
Thanks, Paul.
turns out the best solution was to pass the messages object into another service’s methods as an argument: