users@jersey.java.net

[Jersey] Re: Jersey & Grizzly SSL Server

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Fri, 11 Jan 2013 13:48:58 +0100

Hi Scott,

the example you're referring is Jersey 2.0, which indeed uses different
Grizzly version.
But similar code might be used to configure SSL w/ Jersey 1.16 and
Grizzly 2.2.19.

Not sure how you initialize Grizzly HttpServer, but in order to use SSL
you might want to use this create method:

com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory:
/public static HttpServer createHttpServer(URI u, HttpHandler handler,
boolean secure, SSLEngineConfigurator sslEngineConfigurator)/

and pass SSLEngineConfigurator the same way it is passed in the Jersey
2.0 sample.

Hope this will help.

WBR,
Alexey.

On 01/11/2013 12:46 AM, Scott Natelli wrote:
> Hello,
>
> I am fairly new to Jersey and Grizzly, but for the past few weeks I
> have been working on creating a RESTful service with Jersey using
> POJOs, and implementing an HTTPS server.
>
> I have successfully managed to create a test service using an HTTP
> server with Jersey, but I have been having considerable trouble trying
> to implement the exact same service using an HTTPS server with
> Grizzly. Most if not all of the examples and documentation I have
> found online use the Grizzly 1.x releases, however, I am trying to use
> the latest release of 2.2.19 for Grizzly with the 1.16 release of Jersey.
>
> I have seen and tried to use the HTTPS example found at the github
> repository (link at the bottom of the email), which I am assuming is
> up to date. However, I cannot find the ResourceConfig class that the
> example uses; I have tried adding the following Jersey & Grizzly JARs,
> but none of them resolve the missing class in Netbeans:
>
> * jersey-core-1.16
> * jersey-server-1.16
> * jersey-client-1.16
> * jersey-servlet-1.16
> * jersey-grizzly2-1.16
> * grizzly-http-all-2.2.19 (and I have tried every other available
> 2.2.19 Grizzly JAR)
>
>
> So, I was wondering if there is a compatibility issue between the
> version of Jersey and Grizzly I am trying to use? But if not, then
> where can I find an up to date example of creating an HTTPS server
> that implements SSL, like the example at the repository?
>
> https://github.com/jersey/jersey/tree/master/examples/https-clientserver-grizzly
>
> Thank You,
> Scott