You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2014/05/21 08:05:02 UTC

svn commit: r1596482 - in /felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal: JettyConfig.java JettyService.java

Author: cziegeler
Date: Wed May 21 06:05:02 2014
New Revision: 1596482

URL: http://svn.apache.org/r1596482
Log:
FELIX-4519 : Provide configuration option to disable sending of Server header

Modified:
    felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
    felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java

Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java?rev=1596482&r1=1596481&r2=1596482&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java Wed May 21 06:05:02 2014
@@ -124,6 +124,9 @@ public final class JettyConfig
     /** 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 @@ public final class JettyConfig
         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

Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java?rev=1596482&r1=1596481&r2=1596482&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java Wed May 21 06:05:02 2014
@@ -239,6 +239,7 @@ public final class JettyService extends 
 
             // 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 @@ public final class JettyService extends 
         }
     }
 
+    @Override
     public void lifeCycleStarted(LifeCycle event)
     {
         for (Deployment deployment : this.deployments.values())
@@ -759,6 +761,7 @@ public final class JettyService extends 
         }
     }
 
+    @Override
     public void lifeCycleStopping(LifeCycle event)
     {
         for (Deployment deployment : this.deployments.values())