activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r941673 - in /activemq/trunk: activemq-web-demo/src/test/java/org/apache/activemq/web/ activemq-web/src/main/java/org/apache/activemq/web/
Date Thu, 06 May 2010 11:39:33 GMT
Author: dejanb
Date: Thu May  6 11:39:32 2010
New Revision: 941673

URL: http://svn.apache.org/viewvc?rev=941673&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-1547 - support for configurable selector header
name

Modified:
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java?rev=941673&r1=941672&r2=941673&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java (original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java Thu
May  6 11:39:32 2010
@@ -35,7 +35,7 @@ public class RestTest extends JettyTestS
         ContentExchange contentExchange = new ContentExchange();
         httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
         contentExchange.setURL("http://localhost:8080/message/test?timeout=1000&type=queue");
-        contentExchange.setRequestHeader(WebClient.SELECTOR_NAME, "test=2");
+        contentExchange.setRequestHeader("selector", "test=2");
         httpClient.send(contentExchange);
         contentExchange.waitForDone();
         assertEquals("test2", contentExchange.getResponseContent());

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?rev=941673&r1=941672&r2=941673&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Thu May  6 11:39:32 2010
@@ -156,7 +156,7 @@ public class MessageListenerServlet exte
                         Map<MessageAvailableConsumer, String> consumerDestinationMap
= getConsumerDestinationNameMap(request);
                         client.closeConsumer(destination); // drop any existing
                         // consumer.
-                        MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.SELECTOR_NAME));
+                        MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.selectorName));
 
                         consumer.setAvailableListener(listener);
                         consumerIdMap.put(consumer, message);
@@ -167,7 +167,7 @@ public class MessageListenerServlet exte
                     } else if ("unlisten".equals(type)) {
                         Map<MessageAvailableConsumer, String> consumerIdMap = getConsumerIdMap(request);
                         Map consumerDestinationMap = getConsumerDestinationNameMap(request);
-                        MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.SELECTOR_NAME));
+                        MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.selectorName));
 
                         consumer.setAvailableListener(null);
                         consumerIdMap.remove(consumer);

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java?rev=941673&r1=941672&r2=941673&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java
Thu May  6 11:39:32 2010
@@ -180,7 +180,7 @@ public class MessageServlet extends Mess
                 LOG.debug("Receiving message(s) from: " + destination + " with timeout: "
+ timeout);
             }
 
-            MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.SELECTOR_NAME));
+            MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.selectorName));
             Continuation continuation = null;
             Listener listener = null;
             Message message = null;
@@ -297,7 +297,7 @@ public class MessageServlet extends Mess
                 LOG.debug("Receiving message(s) from: " + destination + " with timeout: "
+ timeout);
             }
 
-            MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.SELECTOR_NAME));
+            MessageAvailableConsumer consumer = (MessageAvailableConsumer)client.getConsumer(destination,
request.getHeader(WebClient.selectorName));
             Message message = null;
 
             // write a responds

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java?rev=941673&r1=941672&r2=941673&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
Thu May  6 11:39:32 2010
@@ -355,6 +355,6 @@ public abstract class MessageServletSupp
     }
     
     protected String getSelector(HttpServletRequest request) throws IOException {
-    	return request.getHeader(WebClient.SELECTOR_NAME);
+    	return request.getHeader(WebClient.selectorName);
     }
 }

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java?rev=941673&r1=941672&r2=941673&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java (original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java Thu May
 6 11:39:32 2010
@@ -70,7 +70,7 @@ public class WebClient implements HttpSe
     public static final String CONNECTION_FACTORY_PREFETCH_PARAM = "org.apache.activemq.connectionFactory.prefetch";
     public static final String CONNECTION_FACTORY_OPTIMIZE_ACK_PARAM = "org.apache.activemq.connectionFactory.optimizeAck";
     public static final String BROKER_URL_INIT_PARAM = "org.apache.activemq.brokerURL";
-    public static final String SELECTOR_NAME = "org.apache.activemq.selector";
+    public static final String SELECTOR_NAME = "org.apache.activemq.selectorName";
 
     private static final Log LOG = LogFactory.getLog(WebClient.class);
 
@@ -81,6 +81,7 @@ public class WebClient implements HttpSe
     private transient Session session;
     private transient MessageProducer producer;
     private int deliveryMode = DeliveryMode.NON_PERSISTENT;
+    public static String selectorName;
 
     private final Semaphore semaphore = new Semaphore(1);
 
@@ -122,6 +123,12 @@ public class WebClient implements HttpSe
     public static void initContext(ServletContext context) {
         initConnectionFactory(context);
         context.setAttribute("webClients", new HashMap<String, WebClient>());
+        if (selectorName == null) {
+            selectorName = context.getInitParameter(SELECTOR_NAME);
+        }
+        if (selectorName == null) {
+            selectorName = "selector";
+        }        
     }
 
     public int getDeliveryMode() {



Mime
View raw message