activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1413931 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
Date Mon, 26 Nov 2012 23:30:32 GMT
Author: chirino
Date: Mon Nov 26 23:30:31 2012
New Revision: 1413931

URL: http://svn.apache.org/viewvc?rev=1413931&view=rev
Log:
Support configuring the client_auth setting on wss transports.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala?rev=1413931&r1=1413930&r2=1413931&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
Mon Nov 26 23:30:31 2012
@@ -25,10 +25,10 @@ import org.eclipse.jetty.server.nio.Sele
 import javax.net.ssl.SSLContext
 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector
 import org.eclipse.jetty.util.thread.ExecutorThreadPool
-import javax.servlet.http.HttpServletRequest
+import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
 import org.eclipse.jetty.websocket.{WebSocket, WebSocketServlet}
 import org.eclipse.jetty.server.{Connector, Server}
-import java.net.{InetSocketAddress, URI}
+import java.net.{URL, InetSocketAddress, URI}
 import java.lang.Class
 import scala.reflect.BeanProperty
 import java.nio.ByteBuffer
@@ -105,6 +105,7 @@ object WebSocketTransportFactory extends
         val scheme = uri.getScheme
         val host = uri.getHost
         var port = uri.getPort
+        val options = URISupport.parseParamters(uri);
 
         scheme match {
           case "ws" =>
@@ -133,7 +134,17 @@ object WebSocketTransportFactory extends
             val connector = new SslSelectChannelConnector
             val ssl_settings = connector.getSslContextFactory;
             ssl_settings.setSslContext(sslContext)
-            ssl_settings.setWantClientAuth(true)
+            options.get("client_auth") match {
+              case null =>
+                ssl_settings.setWantClientAuth(true)
+              case "want" =>
+                ssl_settings.setWantClientAuth(true)
+              case "need" =>
+                ssl_settings.setNeedClientAuth(true)
+              case "none" =>
+              case _ =>
+                warn("Invalid setting for the wss protcol 'client_auth' query option.  Please
set to one of: want, need, or none")
+            }
             connector
         }
         connector.setHost(host)
@@ -199,6 +210,11 @@ object WebSocketTransportFactory extends
       }
     }
 
+    override def doGet(req: HttpServletRequest, resp: HttpServletResponse) {
+      resp.setContentType("application/json")
+      resp.getOutputStream.println("{}");
+    }
+
     def doWebSocketConnect(request: HttpServletRequest, protocol: String) = WebSocketTransport(this,
request, protocol)
   }
 



Mime
View raw message