activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r549845 - in /activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web: MessageServlet.java MessageServletSupport.java WebClient.java
Date Fri, 22 Jun 2007 15:30:37 GMT
Author: jstrachan
Date: Fri Jun 22 08:30:36 2007
New Revision: 549845

URL: http://svn.apache.org/viewvc?view=rev&rev=549845
Log:
applied patch from Dejan Bosanac for AMQ-1227

Modified:
    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/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?view=diff&rev=549845&r1=549844&r2=549845
==============================================================================
--- 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
Fri Jun 22 08:30:36 2007
@@ -93,13 +93,13 @@
             if (log.isDebugEnabled()) {
                 log.debug("Sending message to: " + destination + " with text: " + text);
             }
-
+            
             TextMessage message = client.getSession().createTextMessage(text);
             appendParametersToMessage(request, message);
             boolean persistent = isSendPersistent(request);
             int priority = getSendPriority(request);
             long timeToLive = getSendTimeToLive(request);
-            client.send(destination, message);
+            client.send(destination, message, persistent, priority, timeToLive);
 
             // lets return a unique URI for reliable messaging
             response.setHeader("messageID", message.getJMSMessageID());

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?view=diff&rev=549845&r1=549844&r2=549845
==============================================================================
--- 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
Fri Jun 22 08:30:36 2007
@@ -21,9 +21,8 @@
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
+import javax.jms.DeliveryMode;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.TextMessage;
@@ -52,7 +51,7 @@
 public abstract class MessageServletSupport extends HttpServlet {
 
     private static final transient Log log = LogFactory.getLog(MessageServletSupport.class);
-
+    
     private boolean defaultTopicFlag = true;
     private Destination defaultDestination;
     private String destinationParameter = "destination";
@@ -76,7 +75,6 @@
         if (log.isDebugEnabled()) {
             log.debug("Defaulting to use topics: " + defaultTopicFlag);
         }
-
         name = servletConfig.getInitParameter("destination");
         if (name != null) {
             if (defaultTopicFlag) {
@@ -119,10 +117,6 @@
         if (expiration != null) {
             message.setJMSExpiration(expiration.longValue());
         }
-        Integer priority = asInteger(parameters.remove("JMSPriority"));
-        if (expiration != null) {
-            message.setJMSPriority(priority.intValue());
-        }
         Destination replyTo = asDestination(parameters.remove("JMSReplyTo"));
         if (replyTo != null) {
             message.setJMSReplyTo(replyTo);
@@ -135,7 +129,12 @@
         for (Iterator iter = parameters.entrySet().iterator(); iter.hasNext();) {
             Map.Entry entry = (Map.Entry) iter.next();
             String name = (String) entry.getKey();
-            if (!destinationParameter.equals(name) && !typeParameter.equals(name)
&& !bodyParameter.equals(name)) {
+            if (!destinationParameter.equals(name) 
+            		&& !typeParameter.equals(name) 
+            		&& !bodyParameter.equals(name)
+            		&& !"JMSDeliveryMode".equals(name)
+            		&& !"JMSPriority".equals(name)
+            		&& !"JMSTimeToLive".equals(name)) {
                 Object value = entry.getValue();
                 if (value instanceof Object[]) {
                     Object[] array = (Object[]) value;
@@ -146,7 +145,7 @@
                         log.warn("Can't use property: " + name + " which is of type: " +
value.getClass().getName() + " value");
                         value = null;
                         for (int i = 0, size = array.length; i < size; i++) {
-                            log.debug("value[" + i + "] = " + array[i]);
+                             log.debug("value[" + i + "] = " + array[i]);
                         }
                     }
                 }
@@ -174,6 +173,14 @@
     }
 
     protected boolean isSendPersistent(HttpServletRequest request) {
+    	String text = request.getParameter("JMSDeliveryMode");
+    	if (text != null) {
+    		if (text.trim().equalsIgnoreCase("persistent")) {
+    			return true;
+    		} else {
+    			return false;
+    		}
+    	}
         return defaultMessagePersistent;
     }
 

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?view=diff&rev=549845&r1=549844&r2=549845
==============================================================================
--- 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 Fri Jun
22 08:30:36 2007
@@ -205,7 +205,7 @@
         }
     }
 
-    public void send(Destination destination, Message message, boolean persistent, int priority,
int timeToLive) throws JMSException {
+    public void send(Destination destination, Message message, boolean persistent, int priority,
long timeToLive) throws JMSException {
         int deliveryMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
         getProducer().send(destination, message, deliveryMode, priority, timeToLive);
         if (log.isDebugEnabled()) {



Mime
View raw message