users@grizzly.java.net

Re: Grizzly 2 + Guice + Jersey

From: Ryan Lubke <ryan.lubke_at_oracle.com>
Date: Tue, 05 Jun 2012 08:29:37 -0700

I need to review the Guice API before I attempt an answer.
Will try to have something later today.

On 6/5/12 7:01 AM, Christopher Piggott wrote:
> Hi,
>
> I'm trying to upgrade from Grizzly 1.9 to Grizzly 2, and with a lot of
> problems. I'm currently importing jersey-grizzly2-1.12 as well as
> jersey-grizzly2-servlet-1.12 but neither one of those seems to get me
> what I need, at least not as far as I can tell. It looks like those
> packages might be intended for the non-guice configuration; what I
> really need is to create a webapp that is driven by a filter, not a
> servlet.
>
> I create my main injector (which has bindings for all my jersey
> resource classes):
>
> Injector mainInjector = Guice.createInjector(new ResourceModule());
>
> From that, I can create a GuiceContainer:
>
> ServletConfig cfg = new GuiceContainer(mainInjector);
>
> An SSL Context:
> SSLContextConfigurator sslContext = new SSLContextConfigurator();
> sslContext.setKeyStoreFile("xxx");
> sslContext.setKeyStorePass("yyy");
> sslContext.setTrustStoreFile("zzz");
> sslContext.setTrustStorePass("aaa");
>
>
> A web server:
> HttpServer server = HttpServer.createSimpleServer();
>
>
> Set all the web server's listeners to use SSL only:
> for (NetworkListener listener : server.getListeners()) {
> listener.setSecure(true);
> listener.setSSLEngineConfig(
> new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(true));
> }
>
> but here is where I'm stuck: I dont' know how to take that
> ServletConfig and attach it to the server.
>
> Where am i going wrong?
>
> --Chris