From 9e41d961beaa0a8bf76514afd8715d61560b8286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 13 Jul 2015 23:16:55 +0300 Subject: [PATCH] Send supported versions back in STOMP ERROR version https://stomp.github.io/stomp-specification-1.2.html#Protocol_Negotiation --- .../artemis/core/protocol/stomp/StompConnection.java | 2 +- .../core/protocol/stomp/StompProtocolManager.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index f172b39d42..cf67df4402 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -491,7 +491,7 @@ public final class StompConnection implements RemotingConnection { //not a supported version! ActiveMQStompException error = BUNDLE.versionNotSupported(acceptVersion); - error.addHeader(Stomp.Headers.Error.VERSION, acceptVersion); + error.addHeader(Stomp.Headers.Error.VERSION, manager.getSupportedVersionsAsErrorVersion()); error.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain"); error.setBody("Supported protocol versions are " + manager.getSupportedVersionsAsString()); error.setDisconnect(true); diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java index b9c36c1abd..fa9d0c01f9 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java @@ -387,6 +387,16 @@ class StompProtocolManager implements ProtocolManager, No return versions.substring(1); } + public String getSupportedVersionsAsErrorVersion() + { + String versions = ""; + for (StompVersions version : StompVersions.values()) + { + versions += "," + version; + } + return versions.substring(1); + } + public String getVirtualHostName() { return "activemq";