For everyone that stumbles over this conversation. Here is the code I use
to access the registry outside of jetty. Basically its just about getting
the ServletContext object. If you have two or more WebAppContext you need
to inspect those, since I have only one I can go with the first one.

            WebAppContext context = null;
            for(Handler handler : jettyServer.getServer().getHandlers()) {
                if(handler instanceof WebAppContext) {
                    context = (WebAppContext)handler;
                    break;
                }
            }
            registry =
(Registry)context.getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);


2013/10/19 Martin Kersten <martin.kersten...@gmail.com>

> > Any comments why this is not available by default or did I missed the
> point here and its already in place? <
>
> Done so.
>
> Anyway It is setting a SerializationProvider static property at startup.
> Since I see that the use is only to provide a Token it just makes me think
> that there is a limitation to one instance only.
>
> Anyway. Thanks for the reply. I will try to start up two instances of it
> and check if it works out.
>
> The object locator would be enough. Where is it added as a service? I just
> don't saw the registry object becoming available.
>
>
> 2013/10/19 Thiago H. de Paula Figueiredo <thiag...@gmail.com>
>
> It is, not as the Registry service, but as the ObjectLocator service
>> (Registry extends ObjectLocator and ObjectLocator is the one that declares
>> the getService(), getObject() and autobuild() methods).
>>
>> Tapestry-IoC does *not* impose one Registry per JVM. Same for
>> Tapestry(-core). You can create as many Registry instances you want using
>> RegistryBuilder. Tapestry(-core) automatically creates one Registry per
>> web
>> application, but you can create as many as you want using RegistryBuilder.
>> For more information, read
>> http://tapestry.apache.org/starting-the-ioc-registry.html.
>>
>> By the way, it would be nice to ask how to do something instead of why x
>> doesn't exist, because sometimes it does exist, as that's the case with
>> both statements in the original message in the thread.
>>
>>
>>
>> On Sat, Oct 19, 2013 at 6:21 AM, Martin Kersten <
>> martin.kersten...@gmail.com
>> > wrote:
>>
>> > Hi there,
>> >
>> >    I just wonder why the registry is not available as a service.
>> >
>> > Doing all those test writing I got used to handle the Registry directly.
>> > Since the Registry represents the IOC for me, I just wonder why it is
>> ment
>> > to that the registry can not directly be injected (or do I miss
>> something
>> > here).
>> >
>> > The only reference I found was that the Registry adds itself to the
>> > SerializationSupport. Which by checking the references looks like a
>> relict
>> > and should be removed from the code. It looks like that tapestry tries
>> to
>> > impose a single tapestry instance per JVM which seams to me like a
>> design
>> > flaw. (If you collect things to change for Tapestry 6 maybe one should
>> add
>> > that multiple instances of tapestry should be possible per JVM so no
>> more
>> > use of static references).
>> >
>> > So unitl I missed something, I just wonder why I can not do something
>> like:
>> >
>> > ServiceImpl(Registry){...}
>> >
>> > I can provide it easily by doing something like:
>> >
>> > binder.bind(RegisteryReference.class);
>> >
>> > ---
>> > registery.getService(RegisteryReference).setRegistery(registry);
>> >
>> > And then I inject the reference in my services. The reference uses a
>> weak
>> > link to ease gc on shutdown.
>> >
>> > (Or I just bind a registry wrapper that delegates the registry
>> interaction
>> > towards the real registry once it is created).
>> >
>> > Any comments why this is not available by default or did I missed the
>> point
>> > here and its already in place?
>> >
>> >
>> > Cheers,
>> >
>> > Martin (Kersten),
>> > Germany
>> >
>>
>>
>>
>> --
>> Thiago
>>
>
>

Reply via email to