users@grizzly.java.net

Re: ContextListeners and guice

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Thu, 11 Nov 2010 11:21:58 +0100

Hi Chris,

I'm not familiar with guice, so wanted to ask if you see any issues
related to Grizzly?
ContextListener is regular class, which would be instantiated by
calling Class.newInstance(), so, theoretically guice annotations
should work for it the same way as it works for regular POJOs.

Thanks.

WBR,
Alexey.

> I'm using jersey-guice and grizzly, and set up a context listener:
>
> ServletAdapter sa = new ServletAdapter();
> sa.addServletListener(HomeSrvContextListener.class.getName());
>
> I need to start a background thread, and I'm accustomed to kicking
> this thread off in the context listener. Now I have a situation where
> I would sort of like the context listener to use injection (via guice)
> to create the class that wraps my background thread.
>
> Is this possible?
>
> --Chris