You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/07/13 15:37:50 UTC

[1/4] activemq-artemis git commit: Use more versioned STOMP frames rather than generic

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 970623f52 -> 87ba02b9e


Use more versioned STOMP frames rather than generic


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ebcf0c00
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ebcf0c00
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ebcf0c00

Branch: refs/heads/master
Commit: ebcf0c0080f43e1d276fe4d83bc44a0c968285c3
Parents: 970623f
Author: Ville Skyttä <vi...@iki.fi>
Authored: Fri Jul 10 12:06:48 2015 +0300
Committer: Ville Skyttä <vi...@iki.fi>
Committed: Fri Jul 10 12:06:48 2015 +0300

----------------------------------------------------------------------
 .../artemis/core/protocol/stomp/VersionedStompFrameHandler.java | 2 +-
 .../artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebcf0c00/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
index c689104..2bed68c 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
@@ -165,7 +165,7 @@ public abstract class VersionedStompFrameHandler
 
    public StompFrame handleReceipt(String receiptID)
    {
-      StompFrame receipt = new StompFrame(Stomp.Responses.RECEIPT);
+      StompFrame receipt = createStompFrame(Stomp.Responses.RECEIPT);
       receipt.addHeader(Stomp.Headers.Response.RECEIPT_ID, receiptID);
 
       return receipt;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebcf0c00/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java
----------------------------------------------------------------------
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 5384277..656ed8d 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
@@ -103,7 +103,8 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
          else
          {
             // not valid
-            response = new StompFrame(Stomp.Responses.ERROR, true);
+            response = createStompFrame(Stomp.Responses.ERROR);
+            response.setNeedsDisconnect(true);
             response.addHeader(Stomp.Headers.Error.MESSAGE, "Failed to connect");
             response.setBody("The login account is not valid.");
          }
@@ -268,7 +269,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
 
    public StompFrame createPingFrame()
    {
-      StompFrame frame = new StompFrame(Stomp.Commands.STOMP);
+      StompFrame frame = createStompFrame(Stomp.Commands.STOMP);
       frame.setPing(true);
       return frame;
    }


[4/4] activemq-artemis git commit: This closes #72 Stomp changes

Posted by cl...@apache.org.
This closes #72 Stomp changes


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/87ba02b9
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/87ba02b9
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/87ba02b9

Branch: refs/heads/master
Commit: 87ba02b9e5c41387a748bb9b76262fa93e8a820a
Parents: 970623f 851ac30
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jul 13 09:37:34 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jul 13 09:37:34 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/protocol/stomp/StompFrame.java |  2 +-
 .../stomp/VersionedStompFrameHandler.java       |  2 +-
 .../stomp/v11/StompFrameHandlerV11.java         |  5 +-
 .../core/protocol/stomp/v11/StompFrameV11.java  | 13 ++--
 .../core/protocol/stomp/v12/StompFrameV12.java  | 78 +-------------------
 5 files changed, 15 insertions(+), 85 deletions(-)
----------------------------------------------------------------------



[3/4] activemq-artemis git commit: Auto-add content-length to STOMP 1.1 frames too, inherit 1.2 from 1.1

Posted by cl...@apache.org.
Auto-add content-length to STOMP 1.1 frames too, inherit 1.2 from 1.1


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/851ac30f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/851ac30f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/851ac30f

Branch: refs/heads/master
Commit: 851ac30f326948d4af041cfc96e9e3c588fbcbfd
Parents: 2f6d3dc
Author: Ville Skyttä <vi...@iki.fi>
Authored: Fri Jul 10 14:43:00 2015 +0300
Committer: Ville Skyttä <vi...@iki.fi>
Committed: Fri Jul 10 14:43:00 2015 +0300

----------------------------------------------------------------------
 .../core/protocol/stomp/v11/StompFrameV11.java  | 11 ++-
 .../core/protocol/stomp/v12/StompFrameV12.java  | 76 +-------------------
 2 files changed, 10 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/851ac30f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
index 991c9b7..e0572c7 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
@@ -29,7 +29,7 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
 public class StompFrameV11 extends StompFrame
 {
    //stomp 1.1 talks about repetitive headers.
-   private final List<Header> allHeaders = new ArrayList<Header>();
+   protected final List<Header> allHeaders = new ArrayList<Header>();
 
    public StompFrameV11(String command, Map<String, String> headers, byte[] content)
    {
@@ -66,6 +66,13 @@ public class StompFrameV11 extends StompFrame
             head.append(h.getEncodedValue());
             head.append(Stomp.NEWLINE);
          }
+         if (bytesBody != null && bytesBody.length > 0)
+         {
+            head.append(Stomp.Headers.CONTENT_LENGTH);
+            head.append(Stomp.Headers.SEPARATOR);
+            head.append(bytesBody.length);
+            head.append(Stomp.NEWLINE);
+         }
          // Add a newline to separate the headers from the content.
          head.append(Stomp.NEWLINE);
 
@@ -95,6 +102,4 @@ public class StompFrameV11 extends StompFrame
          allHeaders.add(new Header(key, val));
       }
    }
-
-
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/851ac30f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
index 67d021b..fdf8a70 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
@@ -16,21 +16,12 @@
  */
 package org.apache.activemq.artemis.core.protocol.stomp.v12;
 
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Map;
 
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
-import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
-import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
+import org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameV11;
 
-public class StompFrameV12 extends StompFrame
+public class StompFrameV12 extends StompFrameV11
 {
-   //stomp 1.1 talks about repetitive headers.
-   private final List<Header> allHeaders = new ArrayList<Header>();
-
    public StompFrameV12(String command, Map<String, String> headers, byte[] content)
    {
       super(command, headers, content);
@@ -40,67 +31,4 @@ public class StompFrameV12 extends StompFrame
    {
       super(command);
    }
-
-   @Override
-   public ActiveMQBuffer toActiveMQBuffer() throws Exception
-   {
-      if (buffer == null)
-      {
-         if (bytesBody != null)
-         {
-            buffer = ActiveMQBuffers.dynamicBuffer(bytesBody.length + 512);
-         }
-         else
-         {
-            buffer = ActiveMQBuffers.dynamicBuffer(512);
-         }
-
-         StringBuffer head = new StringBuffer();
-         head.append(command);
-         head.append(Stomp.NEWLINE);
-         // Output the headers.
-         for (Header h : allHeaders)
-         {
-            head.append(h.getEncodedKey());
-            head.append(Stomp.Headers.SEPARATOR);
-            head.append(h.getEncodedValue());
-            head.append(Stomp.NEWLINE);
-         }
-
-         if ((bytesBody != null) && (bytesBody.length > 0))
-         {
-            head.append(Stomp.Headers.CONTENT_LENGTH);
-            head.append(Stomp.Headers.SEPARATOR);
-            head.append(bytesBody.length);
-            head.append(Stomp.NEWLINE);
-         }
-         // Add a newline to separate the headers from the content.
-         head.append(Stomp.NEWLINE);
-
-         buffer.writeBytes(head.toString().getBytes(StandardCharsets.UTF_8));
-         if (bytesBody != null)
-         {
-            buffer.writeBytes(bytesBody);
-         }
-
-         buffer.writeBytes(END_OF_FRAME);
-
-         size = buffer.writerIndex();
-      }
-      return buffer;
-   }
-
-   @Override
-   public void addHeader(String key, String val)
-   {
-      if (!headers.containsKey(key))
-      {
-         headers.put(key, val);
-         allHeaders.add(new Header(key, val));
-      }
-      else if (!key.equals(Stomp.Headers.CONTENT_LENGTH))
-      {
-         allHeaders.add(new Header(key, val));
-      }
-   }
 }


[2/4] activemq-artemis git commit: Use END_OF_FRAME from base StompFrame

Posted by cl...@apache.org.
Use END_OF_FRAME from base StompFrame


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2f6d3dc0
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2f6d3dc0
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2f6d3dc0

Branch: refs/heads/master
Commit: 2f6d3dc064324902589c3592061fe556179b3b43
Parents: ebcf0c0
Author: Ville Skyttä <vi...@iki.fi>
Authored: Fri Jul 10 12:19:18 2015 +0300
Committer: Ville Skyttä <vi...@iki.fi>
Committed: Fri Jul 10 12:19:18 2015 +0300

----------------------------------------------------------------------
 .../apache/activemq/artemis/core/protocol/stomp/StompFrame.java    | 2 +-
 .../activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java    | 2 --
 .../activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java    | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2f6d3dc0/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
----------------------------------------------------------------------
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 84c485b..491c6a9 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
@@ -29,7 +29,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
  */
 public class StompFrame
 {
-   private static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
+   protected static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
 
    protected final String command;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2f6d3dc0/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
index b0e3137..991c9b7 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java
@@ -28,8 +28,6 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
 
 public class StompFrameV11 extends StompFrame
 {
-   private static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
-
    //stomp 1.1 talks about repetitive headers.
    private final List<Header> allHeaders = new ArrayList<Header>();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2f6d3dc0/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
index c9dd728..67d021b 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
@@ -28,8 +28,6 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
 
 public class StompFrameV12 extends StompFrame
 {
-   private static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
-
    //stomp 1.1 talks about repetitive headers.
    private final List<Header> allHeaders = new ArrayList<Header>();