ARTEMIS-230 Copy STOMP content-header back and forth

This commit is contained in:
Julian Scheid 2015-09-25 18:08:57 +02:00
parent 8bb3d1ceaa
commit 235380d5df
2 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,8 @@ public interface Message {
SimpleString HDR_LAST_VALUE_NAME = new SimpleString("_AMQ_LVQ_NAME"); SimpleString HDR_LAST_VALUE_NAME = new SimpleString("_AMQ_LVQ_NAME");
SimpleString HDR_CONTENT_TYPE = new SimpleString("_AMQ_CONTENT_TYPE");
byte DEFAULT_TYPE = 0; byte DEFAULT_TYPE = 0;
byte OBJECT_TYPE = 2; byte OBJECT_TYPE = 2;

View File

@ -59,6 +59,10 @@ public class StompUtils {
if (groupID != null) { if (groupID != null) {
msg.putStringProperty(Message.HDR_GROUP_ID, SimpleString.toSimpleString(groupID)); msg.putStringProperty(Message.HDR_GROUP_ID, SimpleString.toSimpleString(groupID));
} }
String contentType = headers.remove(Stomp.Headers.CONTENT_TYPE);
if (contentType != null) {
msg.putStringProperty(Message.HDR_CONTENT_TYPE, SimpleString.toSimpleString(contentType));
}
Object replyTo = headers.remove(Stomp.Headers.Send.REPLY_TO); Object replyTo = headers.remove(Stomp.Headers.Send.REPLY_TO);
if (replyTo != null) { if (replyTo != null) {
msg.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, SimpleString.toSimpleString((String) replyTo)); msg.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, SimpleString.toSimpleString((String) replyTo));
@ -96,12 +100,16 @@ public class StompUtils {
if (message.getObjectProperty("JMSType") != null) { if (message.getObjectProperty("JMSType") != null) {
command.addHeader(Stomp.Headers.Message.TYPE, message.getObjectProperty("JMSType").toString()); command.addHeader(Stomp.Headers.Message.TYPE, message.getObjectProperty("JMSType").toString());
} }
if (message.getStringProperty(Message.HDR_CONTENT_TYPE.toString()) != null) {
command.addHeader(Stomp.Headers.CONTENT_TYPE, message.getStringProperty(Message.HDR_CONTENT_TYPE.toString()));
}
// now let's add all the message headers // now let's add all the message headers
Set<SimpleString> names = message.getPropertyNames(); Set<SimpleString> names = message.getPropertyNames();
for (SimpleString name : names) { for (SimpleString name : names) {
String value = name.toString(); String value = name.toString();
if (name.equals(ClientMessageImpl.REPLYTO_HEADER_NAME) || if (name.equals(ClientMessageImpl.REPLYTO_HEADER_NAME) ||
name.equals(Message.HDR_CONTENT_TYPE) ||
value.equals("JMSType") || value.equals("JMSType") ||
value.equals("JMSCorrelationID") || value.equals("JMSCorrelationID") ||
value.equals(Stomp.Headers.Message.DESTINATION)) { value.equals(Stomp.Headers.Message.DESTINATION)) {