FELIX-4519 : Provide configuration option to disable sending of Server header
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1596482 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index 43fc55c..1e5571c 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -124,6 +124,9 @@
/** Felix specific property to configure the included cipher suites. */
public static final String FELIX_JETTY_INCLUDED_SUITES = "org.apache.felix.https.jetty.ciphersuites.included";
+ /** Felix specific property to specify whether a server header should be sent (defaults to true) */
+ public static final String FELIX_JETTY_SEND_SERVER_HEADER = "org.apache.felix.http.jetty.sendServerHeader";
+
private static String validateContextPath(String ctxPath)
{
// undefined, empty, or root context path
@@ -335,6 +338,11 @@
return getBooleanProperty(FELIX_HTTP_NIO, true);
}
+ public boolean isSendServerHeader()
+ {
+ return getBooleanProperty(FELIX_JETTY_SEND_SERVER_HEADER, true);
+ }
+
/**
* Returns <code>true</code> if HTTPS is configured to be used (
* {@link #FELIX_HTTPS_ENABLE}) and
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index 236da20..c0b7459 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -239,6 +239,7 @@
// HTTP/1.1 requires Date header if possible (it is)
this.server.setSendDateHeader(true);
+ this.server.setSendServerVersion(this.config.isSendServerHeader());
this.server.addBean(new HashLoginService("OSGi HTTP Service Realm"));
@@ -746,6 +747,7 @@
}
}
+ @Override
public void lifeCycleStarted(LifeCycle event)
{
for (Deployment deployment : this.deployments.values())
@@ -759,6 +761,7 @@
}
}
+ @Override
public void lifeCycleStopping(LifeCycle event)
{
for (Deployment deployment : this.deployments.values())