applied patch from Dejan Bosanac for AMQ-1227

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@549845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-06-22 15:30:36 +00:00
parent fccb3cc2b0
commit e7ca882392
3 changed files with 20 additions and 13 deletions

View File

@ -99,7 +99,7 @@ public class MessageServlet extends MessageServletSupport {
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());

View File

@ -21,9 +21,8 @@ package org.apache.activemq.web;
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;
@ -76,7 +75,6 @@ public abstract class MessageServletSupport extends HttpServlet {
if (log.isDebugEnabled()) {
log.debug("Defaulting to use topics: " + defaultTopicFlag);
}
name = servletConfig.getInitParameter("destination");
if (name != null) {
if (defaultTopicFlag) {
@ -119,10 +117,6 @@ public abstract class MessageServletSupport extends HttpServlet {
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 @@ public abstract class MessageServletSupport extends HttpServlet {
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;
@ -174,6 +173,14 @@ public abstract class MessageServletSupport extends HttpServlet {
}
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;
}

View File

@ -205,7 +205,7 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
}
}
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()) {