Thanks, I am going to try this and get back to you.
On Tue, Jun 5, 2012 at 12:42 PM, Ryan Lubke <ryan.lubke_at_oracle.com> wrote:
> Looking at the docs for GuiceContainer shows that it implements
> javax.servlet.{Filter,Servlet} interfaces.
>
> So you could do something like:
>
> WebappContext ctx = new WebappContext("Test", "/test");
> ServletRegistration reg = ctx.addServlet("whatchamacallit", new
> GuiceContainer(mainInjector));
> reg.addMapping("/somePath");
>
> ctx.deploy(yourHttpServerInstanceRef);
>
> Though I'm not 100% certain this is the best approach. The jersey-guice
> module [1] in the Jersey source base
> has many unit tests that use Grizzly 2. Might be worth spending some time
> looking through the unit tests to
> review what they do.
>
> [1]
> http://java.net/projects/jersey/sources/svn/show/trunk/jersey/contribs/jersey-guice?rev=5717
>
>
>
> 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
>
>