activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1378035 - in /activemq/trunk/activemq-optional/src: main/java/org/apache/activemq/transport/ main/java/org/apache/activemq/transport/ws/ main/java/org/apache/activemq/transport/wss/ test/java/org/apache/activemq/transport/ws/
Date Tue, 28 Aug 2012 09:24:54 GMT
Author: dejanb
Date: Tue Aug 28 09:24:53 2012
New Revision: 1378035

URL: http://svn.apache.org/viewvc?rev=1378035&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3980 - generic support for all web socket tuning
options

Modified:
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/SocketConnectorFactory.java
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportFactory.java
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/wss/WSSTransportFactory.java
    activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/SocketConnectorFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/SocketConnectorFactory.java?rev=1378035&r1=1378034&r2=1378035&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/SocketConnectorFactory.java
(original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/SocketConnectorFactory.java
Tue Aug 28 09:24:53 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.transport;
 
+import org.apache.activemq.util.IntrospectionSupport;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
@@ -27,7 +28,9 @@ public class SocketConnectorFactory {
     private Map<String, Object> transportOptions;
 
     public Connector createConnector() throws Exception {
-       return new SelectChannelConnector();
+        SelectChannelConnector connector = new SelectChannelConnector();
+        IntrospectionSupport.setProperties(connector, transportOptions, "");
+        return connector;
     }
 
     public Map<String, Object> getTransportOptions() {

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportFactory.java?rev=1378035&r1=1378034&r2=1378035&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportFactory.java
(original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/WSTransportFactory.java
Tue Aug 28 09:24:53 2012
@@ -28,7 +28,6 @@ import org.apache.activemq.transport.Tra
 import org.apache.activemq.util.IOExceptionSupport;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.URISupport;
-
 /**
  * 
  * Factory for WebSocket (ws) transport
@@ -40,7 +39,7 @@ public class WSTransportFactory extends 
         try {
             Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
             WSTransportServer result = new WSTransportServer(location);
-            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options,
"transport.");
+            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options,
"");
             result.setTransportOption(transportOptions);
             return result;
         } catch (URISyntaxException e) {

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=1378035&r1=1378034&r2=1378035&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
Tue Aug 28 09:24:53 2012
@@ -41,8 +41,6 @@ import java.util.Map;
  */
 public class WSTransportServer extends WebTransportServerSupport {
 
-    int maxTextMessageSize = -1;
-
     public WSTransportServer(URI location) {
         super(location);
         this.bindAddress = location;
@@ -64,9 +62,14 @@ public class WSTransportServer extends W
                 new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY);
 
         ServletHolder holder = new ServletHolder();
-        if (maxTextMessageSize != -1) {
-            holder.setInitParameter("maxTextMessageSize", String.valueOf(maxTextMessageSize));
+        Map<String, Object> webSocketOptions = IntrospectionSupport.extractProperties(transportOptions,
"websocket.");
+        for(Map.Entry<String,Object> webSocketEntry : webSocketOptions.entrySet())
{
+            Object value = webSocketEntry.getValue();
+            if (value != null) {
+                holder.setInitParameter(webSocketEntry.getKey(), value.toString());
+            }
         }
+
         holder.setServlet(new StompServlet());
         contextHandler.addServlet(holder, "/");
 
@@ -97,16 +100,9 @@ public class WSTransportServer extends W
 
     @Override
     public void setTransportOption(Map<String, Object> transportOptions) {
-        IntrospectionSupport.setProperties(this, transportOptions);
-        socketConnectorFactory.setTransportOptions(transportOptions);
+        Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(transportOptions,
"transport.");
+        socketConnectorFactory.setTransportOptions(socketOptions);
         super.setTransportOption(transportOptions);
     }
 
-    public int getMaxTextMessageSize() {
-        return maxTextMessageSize;
-    }
-
-    public void setMaxTextMessageSize(int maxTextMessageSize) {
-        this.maxTextMessageSize = maxTextMessageSize;
-    }
 }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/wss/WSSTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/wss/WSSTransportFactory.java?rev=1378035&r1=1378034&r2=1378035&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/wss/WSSTransportFactory.java
(original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/wss/WSSTransportFactory.java
Tue Aug 28 09:24:53 2012
@@ -41,7 +41,7 @@ public class WSSTransportFactory extends
         try {
             Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
             WSSTransportServer result = new WSSTransportServer(location, SslContext.getCurrentSslContext());
-            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options,
"transport.");
+            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options,
"");
             result.setTransportOption(transportOptions);
             return result;
         } catch (URISyntaxException e) {

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java?rev=1378035&r1=1378034&r2=1378035&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
(original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
Tue Aug 28 09:24:53 2012
@@ -64,7 +64,7 @@ public class WSTransportTest {
                 new URI("broker:()/localhost?persistent=false&useJmx=false"));
 
         stompUri = broker.addConnector("stomp://localhost:0").getPublishableConnectString();
-        wsUri = broker.addConnector("ws://127.0.0.1:61623").getPublishableConnectString();
+        wsUri = broker.addConnector("ws://127.0.0.1:61623?websocket.maxTextMessageSize=99999&transport.maxIdleTime=1001").getPublishableConnectString();
         broker.setDeleteAllMessagesOnStartup(deleteMessages);
         broker.start();
         broker.waitUntilStarted();



Mime
View raw message