users@jersey.java.net

Re: [Jersey] Context Notifier reload no longer works on jersey 1.4

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 5 Oct 2010 12:59:03 +0200

On Sep 24, 2010, at 2:22 PM, Guilhem wrote:

> hi paul,
> your piece of code give me an idea. I could have the same
> functionality that before by doing :
>
> @Override
> protected void configure(final ServletConfig sc, ResourceConfig
> rc, WebApplication wa) {
> super.configure(sc, rc, wa);
>
> /* I remove this piece of code
> if (!configured) {
> final ContainerNotifierImpl cnImpl = new
> ContainerNotifierImpl();
>
> rc.getProperties().put(ResourceConfig.PROPERTY_CONTAINER_NOTIFIER,
> cnImpl);
> rc.getSingletons().add(new
> ContextInjectableProvider
> <ContainerNotifierImpl>(ContainerNotifierImpl.class, cnImpl));
> configured = true;
> }*/
> }
>
> @Override
> protected void initiate(ResourceConfig rc, WebApplication wa) {
> // and put it here
> final ContainerNotifierImpl cnImpl = new
> ContainerNotifierImpl();
>
> rc.getProperties().put(ResourceConfig.PROPERTY_CONTAINER_NOTIFIER,
> cnImpl);
> rc.getSingletons().add(new
> ContextInjectableProvider
> <ContainerNotifierImpl>(ContainerNotifierImpl.class, cnImpl));
> wa.initiate(rc);
>
> }
>
> this is supposed to works right?
>

Until we fix this why not just override the initiate method to do this:

    protected void initiate(ResourceConfig rc, WebApplication wa) {
        wa.initiate(rc);
    }

and leave your original code in place?

Paul.