incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [1/2] git commit: Fixed BLUR-380: Made the jetty server ssl enabled if configured that way
Date Sun, 07 Dec 2014 12:43:40 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 2484173d0 -> 415daaeff


Fixed BLUR-380: Made the jetty server ssl enabled if configured that way


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/c2baf121
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/c2baf121
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/c2baf121

Branch: refs/heads/master
Commit: c2baf121cf9c060305da6baaa7719ca4fe2751c5
Parents: 2484173
Author: Chris Rohr <rohr.chris@gmail.com>
Authored: Sun Dec 7 07:35:42 2014 -0500
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Sun Dec 7 07:35:42 2014 -0500

----------------------------------------------------------------------
 .../org/apache/blur/console/JettyServer.java    | 42 +++++++++++++-------
 1 file changed, 28 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c2baf121/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
----------------------------------------------------------------------
diff --git a/blur-console/src/main/java/org/apache/blur/console/JettyServer.java b/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
index 35e2a4b..6127477 100644
--- a/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
+++ b/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
@@ -17,27 +17,28 @@ package org.apache.blur.console;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
 import org.apache.blur.console.filters.LoggedInFilter;
-import org.apache.blur.console.servlets.*;
+import org.apache.blur.console.servlets.AuthServlet;
+import org.apache.blur.console.servlets.JavascriptServlet;
+import org.apache.blur.console.servlets.NodesServlet;
+import org.apache.blur.console.servlets.QueriesServlet;
+import org.apache.blur.console.servlets.SearchServlet;
+import org.apache.blur.console.servlets.TablesServlet;
+import org.apache.blur.console.util.Config;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.handler.HandlerList;
-import org.eclipse.jetty.server.session.HashSessionIdManager;
-import org.eclipse.jetty.server.session.HashSessionManager;
 import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.*;
+import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
+import org.eclipse.jetty.servlet.FilterMapping;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.webapp.WebAppContext;
 
-import javax.servlet.DispatcherType;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
 public class JettyServer {
   private int port;
   private Server server;
@@ -69,6 +70,19 @@ public class JettyServer {
 
   private void createServer() throws MalformedURLException {
     server = new Server(port);
+    
+    if (Boolean.parseBoolean(Config.getBlurConfig().get("blur.console.ssl.enable", "false")))
{
+    	SslContextFactory factory = new SslContextFactory(Boolean.parseBoolean(Config.getBlurConfig().get("blur.console.ssl.hostname.match",
"true")));
+    	factory.setKeyStorePath(Config.getBlurConfig().get("blur.console.ssl.keystore.path"));
+    	factory.setKeyStorePassword(Config.getBlurConfig().get("blur.console.ssl.keystore.password"));
+    	factory.setTrustStore(Config.getBlurConfig().get("blur.console.ssl.truststore.path"));
+    	factory.setTrustStorePassword(Config.getBlurConfig().get("blur.console.ssl.truststore.password"));
+    	
+    	SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(factory);
+    	sslConnector.setPort(port);
+    	
+    	server.addConnector(sslConnector);
+    }
 
     // for localhost:port/console/index.html and whatever else is in the webapp directory
     URL warUrl = null;


Mime
View raw message