Send supported versions back in STOMP ERROR version

https://stomp.github.io/stomp-specification-1.2.html#Protocol_Negotiation
This commit is contained in:
Ville Skyttä 2015-07-13 23:16:55 +03:00 committed by Clebert Suconic
parent 6199d4ee11
commit 9e41d961be
2 changed files with 11 additions and 1 deletions

View File

@ -491,7 +491,7 @@ public final class StompConnection implements RemotingConnection
{ {
//not a supported version! //not a supported version!
ActiveMQStompException error = BUNDLE.versionNotSupported(acceptVersion); 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.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain");
error.setBody("Supported protocol versions are " + manager.getSupportedVersionsAsString()); error.setBody("Supported protocol versions are " + manager.getSupportedVersionsAsString());
error.setDisconnect(true); error.setDisconnect(true);

View File

@ -387,6 +387,16 @@ class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, No
return versions.substring(1); return versions.substring(1);
} }
public String getSupportedVersionsAsErrorVersion()
{
String versions = "";
for (StompVersions version : StompVersions.values())
{
versions += "," + version;
}
return versions.substring(1);
}
public String getVirtualHostName() public String getVirtualHostName()
{ {
return "activemq"; return "activemq";