activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1214770 - /activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java
Date Thu, 15 Dec 2011 14:23:21 GMT
Author: dejanb
Date: Thu Dec 15 14:23:21 2011
New Revision: 1214770

URL: http://svn.apache.org/viewvc?rev=1214770&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3504 - fixing websocket transport support

Modified:
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java?rev=1214770&r1=1214769&r2=1214770&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java
(original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java
Thu Dec 15 14:23:21 2011
@@ -17,20 +17,17 @@
 
 package org.apache.activemq.transport.ws;
 
-import java.net.InetSocketAddress;
-import java.net.URI;
-
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.transport.TransportServerSupport;
 import org.apache.activemq.util.ServiceStopper;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.bio.SocketConnector;
-import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.servlet.ServletMapping;
+
+import java.net.InetSocketAddress;
+import java.net.URI;
 
 /**
  * Creates a web server and registers web socket server
@@ -50,38 +47,19 @@ public class WSTransportServer extends T
     protected void doStart() throws Exception {
         server = new Server();
         if (connector == null) {
-            connector = new SocketConnector();
+            connector = new SelectChannelConnector();
         }
         connector.setHost(bindAddress.getHost());
         connector.setPort(bindAddress.getPort());
-        server.setConnectors(new Connector[] {
-                connector
-        });
-
-        ServletContextHandler contextHandler = new ServletContextHandler();
-        contextHandler.setContextPath("/");
-        contextHandler.setServer(server);
-        server.setHandler(contextHandler);
-
-        SessionHandler sessionHandler = new SessionHandler();
-        contextHandler.setHandler(sessionHandler);
+        connector.setServer(server);
+        server.addConnector(connector);
 
-        ServletHandler servletHandler = new ServletHandler();
-        sessionHandler.setHandler(servletHandler);
+        ServletContextHandler contextHandler =
+                new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY);
 
         ServletHolder holder = new ServletHolder();
-        holder.setName("WSStomp");
-        holder.setClassName(StompServlet.class.getName());
-        servletHandler.setServlets(new ServletHolder[] {
-            holder
-        });
-
-        ServletMapping mapping = new ServletMapping();
-        mapping.setServletName("WSStomp");
-        mapping.setPathSpec("/*");
-        servletHandler.setServletMappings(new ServletMapping[] {
-            mapping
-        });
+        holder.setServlet(new StompServlet());
+        contextHandler.addServlet(holder, "/");
 
         contextHandler.setAttribute("acceptListener", getAcceptListener());
 



Mime
View raw message