activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r395717 - in /incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web: MessageListenerServlet.java MessageServletSupport.java
Date Thu, 20 Apr 2006 22:37:09 GMT
Author: aco
Date: Thu Apr 20 15:37:03 2006
New Revision: 395717

URL: http://svn.apache.org/viewcvs?rev=395717&view=rev
Log:
- Read the first string of the request parameter if the value is a String[]
- Appended the message properties in the MessageListenerServlet.

Modified:
    incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
    incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java

Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?rev=395717&r1=395716&r2=395717&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
(original)
+++ incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Thu Apr 20 15:37:03 2006
@@ -162,7 +162,8 @@
                     else if ("send".equals(type))
                     {
                         TextMessage message = client.getSession().createTextMessage(messages[i]);
-                        // TODO sent message parameters
+                        appendParametersToMessage(request, message);
+
                         client.send(destination, message);
                         message_ids+=message.getJMSMessageID()+"\n";
                         if (log.isDebugEnabled()) {
@@ -201,6 +202,8 @@
                     Destination destination=getDestination(client, request);
                     String body = getPostedMessageBody(request);
                     TextMessage message = client.getSession().createTextMessage(body );
+                    appendParametersToMessage(request, message);
+
                     client.send(destination, message);
                     if (log.isDebugEnabled()) {
                         log.debug("Sent to destination: " + destination + " body: " + body);

Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java?rev=395717&r1=395716&r2=395717&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
(original)
+++ incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
Thu Apr 20 15:37:03 2006
@@ -116,7 +116,7 @@
 
     protected void appendParametersToMessage(HttpServletRequest request, TextMessage message)
throws JMSException {
         Map parameters = new HashMap(request.getParameterMap());
-        String correlationID = (String) parameters.remove("JMSCorrelationID");
+        String correlationID = asString(parameters.remove("JMSCorrelationID"));
         if (correlationID != null) {
             message.setJMSCorrelationID(correlationID);
         }
@@ -132,7 +132,7 @@
         if (replyTo != null) {
             message.setJMSReplyTo(replyTo);
         }
-        String type = (String) parameters.remove("JMSType");
+        String type = (String) asString(parameters.remove("JMSType"));
         if (correlationID != null) {
             message.setJMSType(type);
         }
@@ -170,6 +170,10 @@
             String text = (String) value;
             return ActiveMQDestination.createDestination(text, ActiveMQDestination.QUEUE_TYPE);
         }
+        if (value instanceof String[]) {
+            String text = ((String[]) value)[0];
+            return ActiveMQDestination.createDestination(text, ActiveMQDestination.QUEUE_TYPE);
+        }
         return null;
     }
 
@@ -180,6 +184,9 @@
         if (value instanceof String) {
             return Integer.valueOf((String) value);
         }
+        if (value instanceof String[]) {
+            return Integer.valueOf(((String[]) value)[0]);
+        }
         return null;
     }
 
@@ -190,6 +197,21 @@
         if (value instanceof String) {
             return Long.valueOf((String) value);
         }
+        if (value instanceof String[]) {
+            return Long.valueOf(((String[]) value)[0]);
+        }
+        return null;
+    }
+
+    protected String asString(Object value) {
+        if (value instanceof String[]) {
+            return ((String[])value)[0];
+        }
+
+        if (value != null) {
+            return value.toString();
+        }
+
         return null;
     }
 



Mime
View raw message