On Thu, Apr 11, 2019 at 7:54 AM Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi Thiago,
>

Hi!


> I discovered a mailing-list post, from around 9 years ago, where you
> advised someone to override the TapestryFilter.init(Registry registry)
> method to save the registry to a static field.
>

That's a last resort solution when you cannot access the ServletContext.


> Ideally, I'd like to invoke the static method of a standalone class to
> access the registry and its hosted services, rather than employ the likes
> of ApplicationGlobals or ObjectLocator, as per the custom Configurator
> examples posted earlier.
>

You don't need to use ApplicationGlobals nor ObjectLocator (which is
basically the interface that defines the Tapestry-IoC registry) in this
case.


> My ServerEndpoint class is not stateless, as it contains the likes of
> Multimaps of endpoints, necessary for broadcasting to multiple clients
> etc.  So it's not just a matter of ensuring that injected services work,
> but also that class (static) field values are shared across all instances
> of the endpoint (configured in AppModule to be autobuilt with 'PERTHREAD'
> scope).
>

Why do you need static field in your service? Couldn't you move them to a
singleton service and then use it in your endpoint service?


> My efforts are based on the assumption that the surest way of ensuring
> that ALL instances of my ServerEndpoint class have working injected
> services, and identical class (static) field values, is that these
> endpoints all originate from the same IoC registry.
>

Yes, it is.


> Tapestry services are easy.  ServerEndpoints are easy.  Marrying the two
> is proving a little tricky.  :-)
>

Didn't you already find the solution for this, as your other message said?


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

-- 
Thiago

Reply via email to