mirror of https://github.com/apache/activemq.git
frame builder was not adding all the properties (they were not all String values).
Connect should also use the\0\n convention that the frame builder uses. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@394269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70c5073fb3
commit
5c03c7df96
|
@ -91,6 +91,7 @@ class Connect implements StompCommand {
|
||||||
buffer.append(Stomp.NEWLINE);
|
buffer.append(Stomp.NEWLINE);
|
||||||
buffer.append(Stomp.NEWLINE);
|
buffer.append(Stomp.NEWLINE);
|
||||||
buffer.append(Stomp.NULL);
|
buffer.append(Stomp.NULL);
|
||||||
|
buffer.append(Stomp.NEWLINE);
|
||||||
out.writeBytes(buffer.toString());
|
out.writeBytes(buffer.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
class FrameBuilder {
|
class FrameBuilder {
|
||||||
private String command;
|
private String command;
|
||||||
|
@ -95,22 +96,23 @@ class FrameBuilder {
|
||||||
byte[] toFrame() {
|
byte[] toFrame() {
|
||||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
try {
|
try {
|
||||||
bout.write(command.getBytes());
|
bout.write(command.getBytes("UTF-8"));
|
||||||
bout.write(Stomp.NEWLINE.getBytes());
|
bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
|
||||||
for (Iterator iterator = headers.keySet().iterator(); iterator.hasNext();) {
|
for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();) {
|
||||||
String key = (String) iterator.next();
|
Map.Entry entry = (Entry) iterator.next();
|
||||||
String property = headers.getProperty(key);
|
String key = (String) entry.getKey();
|
||||||
|
String property = entry.getValue().toString();
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
bout.write(key.getBytes());
|
bout.write(key.getBytes("UTF-8"));
|
||||||
bout.write(Stomp.Headers.SEPERATOR.getBytes());
|
bout.write(Stomp.Headers.SEPERATOR.getBytes("UTF-8"));
|
||||||
bout.write(property.getBytes());
|
bout.write(property.getBytes("UTF-8"));
|
||||||
bout.write(Stomp.NEWLINE.getBytes());
|
bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bout.write(Stomp.NEWLINE.getBytes());
|
bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
|
||||||
bout.write(body);
|
bout.write(body);
|
||||||
bout.write(Stomp.NULL.getBytes());
|
bout.write(Stomp.NULL.getBytes("UTF-8"));
|
||||||
bout.write(Stomp.NEWLINE.getBytes());
|
bout.write(Stomp.NEWLINE.getBytes("UTF-8"));
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new RuntimeException("World is caving in, we just got io error writing to" + "a byte array output stream we instantiated!");
|
throw new RuntimeException("World is caving in, we just got io error writing to" + "a byte array output stream we instantiated!");
|
||||||
|
|
Loading…
Reference in New Issue