diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java index 19e7ddae91..3bbe88f878 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java @@ -162,8 +162,11 @@ public class StompDecoder //max len of EOL (default is 1 for '\n') protected int eolLen = 1; - public StompDecoder() + private final VersionedStompFrameHandler handler; + + public StompDecoder(VersionedStompFrameHandler handler) { + this.handler = handler; } public boolean hasBytes() @@ -276,7 +279,9 @@ public class StompDecoder // reset - StompFrame ret = new StompFrame(command, headers, content); + StompFrame ret = handler.createStompFrame(command); + ret.headers = headers; + ret.setByteBody(content); init(); diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java index 491c6a97f7..cb6ede5b75 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java @@ -33,7 +33,7 @@ public class StompFrame protected final String command; - protected final Map headers; + protected Map headers; private String body; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java index 7cbf77157c..e492060bb2 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java @@ -35,7 +35,7 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements public StompFrameHandlerV10(StompConnection connection) { super(connection); - decoder = new StompDecoder(); + decoder = new StompDecoder(this); decoder.init(); connection.addStompEventListener(this); } diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java index 656ed8de46..e30742eb5e 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java @@ -41,7 +41,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements { super(connection); connection.addStompEventListener(this); - decoder = new StompDecoderV11(); + decoder = new StompDecoderV11(this); decoder.init(); } @@ -428,6 +428,11 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements protected boolean isEscaping = false; protected SimpleBytes holder = new SimpleBytes(1024); + public StompDecoderV11(StompFrameHandlerV11 handler) + { + super(handler); + } + @Override public void init(StompDecoder decoder) { diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java index ca9b6fe321..b1632e7408 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java @@ -35,7 +35,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 implements FrameE public StompFrameHandlerV12(StompConnection connection) { super(connection); - decoder = new StompDecoderV12(); + decoder = new StompDecoderV12(this); decoder.init(); } @@ -99,9 +99,11 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 implements FrameE { protected boolean nextEOLChar = false; - public StompDecoderV12() + public StompDecoderV12(StompFrameHandlerV12 handler) { - //1.2 allow '\r\n' + super(handler); + + //1.2 allows '\r\n' eolLen = 2; }