Hi,
On 01/23/2012 11:04 AM, Chanchal Tyagi wrote:
> Hi,
>
> Does grizzly 2.1.8 supports https ?
sure, you have to set proper SSLEngineConfig to NetworkListener.
Here is the sample code, how we set SSL configuration in our unit test [1].
/
private void configureHttpServer() throws Exception {
httpServer = new HttpServer();
final NetworkListener listener =
new NetworkListener("grizzly",
NetworkListener.DEFAULT_NETWORK_HOST,
PORT);
if (isSslEnabled) {
listener.setSecure(true);
listener.setSSLEngineConfig(createSSLConfig(true));
}
httpServer.addListener(listener);
}
private static SSLEngineConfigurator createSSLConfig(boolean
isServer) throws Exception {
final SSLContextConfigurator sslContextConfigurator =
new SSLContextConfigurator();
final ClassLoader cl = SuspendTest.class.getClassLoader();
// override system properties
final URL cacertsUrl = cl.getResource("ssltest-cacerts.jks");
if (cacertsUrl != null) {
sslContextConfigurator.setTrustStoreFile(cacertsUrl.getFile());
sslContextConfigurator.setTrustStorePass("changeit");
}
// override system properties
final URL keystoreUrl = cl.getResource("ssltest-keystore.jks");
if (keystoreUrl != null) {
sslContextConfigurator.setKeyStoreFile(keystoreUrl.getFile());
sslContextConfigurator.setKeyStorePass("changeit");
}
return new
SSLEngineConfigurator(sslContextConfigurator.createSSLContext(),
false, false, false);
}/
WBR,
Alexey.
[1]
http://java.net/projects/grizzly/sources/git/content/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/SuspendTest.java?rev=9b3f3d9eb07fa36ecd1732b3135cf3128a5a1977
> If yes, then Please help me in setting up ssl configuration
>
>
> Thanks
> -Chanchal