Merge pull request #615 from mattrpav/AMQ-6951

AMQ-6951 Hide jetty version
This commit is contained in:
Matt Pavlovich 2021-03-18 09:00:03 -05:00 committed by GitHub
commit 0d0272d249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 4 deletions

View File

@ -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 =

View File

@ -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 =

View File

@ -20,6 +20,10 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<property name="sendServerVersion" value="false"/>
</bean>
<bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
<property name="name" value="ActiveMQRealm" />
<property name="config" value="${activemq.conf}/jetty-realm.properties" />
@ -141,9 +145,16 @@
<property name="targetMethod" value="setConnectors" />
<property name="arguments">
<list>
<bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
<constructor-arg ref="Server" />
<!-- see the jettyPort bean -->
<bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
<constructor-arg ref="Server"/>
<constructor-arg>
<list>
<bean id="httpConnectionFactory" class="org.eclipse.jetty.server.HttpConnectionFactory">
<constructor-arg ref="httpConfig"/>
</bean>
</list>
</constructor-arg>
<!-- see the jettyPort bean -->
<property name="host" value="#{systemProperties['jetty.host']}" />
<property name="port" value="#{systemProperties['jetty.port']}" />
</bean>