From 79f1c2feb7da7a632256afaec103f3740ab45822 Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Tue, 2 Mar 2021 10:44:40 -0600 Subject: [PATCH] [AMQ-6951] Hide embedded jetty version - WS transport - HTTP transport --- .../activemq/transport/http/HttpTransportServer.java | 9 ++++++++- .../apache/activemq/transport/ws/WSTransportServer.java | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java index 370742951a..f0ecefd00f 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java @@ -28,8 +28,9 @@ import org.apache.activemq.transport.util.TextWireFormat; import org.apache.activemq.transport.xstream.XStreamWireFormat; import org.apache.activemq.util.ServiceStopper; import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -82,6 +83,12 @@ public class HttpTransportServer extends WebTransportServerSupport { connector = socketConnectorFactory.createConnector(server); } + for(ConnectionFactory cf : connector.getConnectionFactories()) { + if(HttpConnectionFactory.class.isAssignableFrom(cf.getClass())) { + HttpConnectionFactory.class.cast(cf).getHttpConfiguration().setSendServerVersion(false); + } + } + URI boundTo = bind(); ServletContextHandler contextHandler = diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java index ea8867d76e..7aaaecc736 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java @@ -32,7 +32,9 @@ import org.apache.activemq.transport.ws.jetty9.WSServlet; import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.util.ServiceStopper; import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -64,6 +66,12 @@ public class WSTransportServer extends WebTransportServerSupport implements Brok connector = socketConnectorFactory.createConnector(server); } + for(ConnectionFactory cf : connector.getConnectionFactories()) { + if(HttpConnectionFactory.class.isAssignableFrom(cf.getClass())) { + HttpConnectionFactory.class.cast(cf).getHttpConfiguration().setSendServerVersion(false); + } + } + URI boundTo = bind(); ServletContextHandler contextHandler =