From 03ae70ae54bb4dac1a69bd0e692d759ab64f25ba Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Wed, 3 Dec 2014 10:43:24 -0800 Subject: [PATCH] SSL-capable ServiceEmitter. --- .../server/initialization/HttpEmitterModule.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/io/druid/server/initialization/HttpEmitterModule.java b/server/src/main/java/io/druid/server/initialization/HttpEmitterModule.java index f384287f726..4e7c083bee6 100644 --- a/server/src/main/java/io/druid/server/initialization/HttpEmitterModule.java +++ b/server/src/main/java/io/druid/server/initialization/HttpEmitterModule.java @@ -20,6 +20,7 @@ package io.druid.server.initialization; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Throwables; import com.google.common.base.Supplier; import com.google.inject.Binder; import com.google.inject.Module; @@ -37,6 +38,7 @@ import io.druid.guice.ManageLifecycle; import javax.annotation.Nullable; import javax.net.ssl.SSLContext; +import java.security.NoSuchAlgorithmException; /** */ @@ -47,8 +49,14 @@ public class HttpEmitterModule implements Module { JsonConfigProvider.bind(binder, "druid.emitter.http", HttpEmitterConfig.class); - // Fix the injection of this if we want to enable ssl emission of events. - binder.bind(SSLContext.class).toProvider(Providers.of(null)).in(LazySingleton.class); + final SSLContext context; + try { + context = SSLContext.getDefault(); + } catch (NoSuchAlgorithmException e) { + throw Throwables.propagate(e); + } + + binder.bind(SSLContext.class).toProvider(Providers.of(context)).in(LazySingleton.class); } @Provides