felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1197013 - in /felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal: JettyConfig.java JettyService.java
Date Thu, 03 Nov 2011 09:22:27 GMT
Author: fmeschbe
Date: Thu Nov  3 09:22:27 2011
New Revision: 1197013

URL: http://svn.apache.org/viewvc?rev=1197013&view=rev
Log:
FELIX-3197 Add org.apache.felix.http.host configuration property to configure the interface
on which Jetty is to listen

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=1197013&r1=1197012&r2=1197013&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
Thu Nov  3 09:22:27 2011
@@ -26,6 +26,9 @@ import java.util.Hashtable;
 
 public final class JettyConfig
 {
+    /** Felix specific property to set the interface to listen on. Applies to both HTTP and
HTTP */
+    private static final String FELIX_HOST = "org.apache.felix.http.host";
+
     /** Standard OSGi port property for HTTP service */
     private static final String HTTP_PORT = "org.osgi.service.http.port";
 
@@ -75,6 +78,7 @@ public final class JettyConfig
 
     private final BundleContext context;
     private boolean debug;
+    private String host;
     private int httpPort;
     private int httpsPort;
     private String keystore;
@@ -145,6 +149,11 @@ public final class JettyConfig
         return this.registerMBeans;
     }
 
+    public String getHost()
+    {
+        return this.host;
+    }
+
     public int getHttpPort()
     {
         return this.httpPort;
@@ -197,6 +206,7 @@ public final class JettyConfig
         }
 
         this.debug = getBooleanProperty(props, FELIX_HTTP_DEBUG, getBooleanProperty(props,
HTTP_DEBUG, false));
+        this.host = getProperty(props, FELIX_HOST, null);
         this.httpPort = getIntProperty(props, HTTP_PORT, 8080);
         this.httpsPort = getIntProperty(props, HTTPS_PORT, 8443);
         this.keystore = getProperty(props, FELIX_KEYSTORE, this.context.getProperty(OSCAR_KEYSTORE));

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=1197013&r1=1197012&r2=1197013&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
Thu Nov  3 09:22:27 2011
@@ -201,7 +201,7 @@ public final class JettyService
                 ? new SelectChannelConnector()
                 : new SocketConnector();
         connector.setPort(this.config.getHttpPort());
-        connector.setMaxIdleTime(60000);
+        configureConnector(connector);
         this.server.addConnector(connector);
     }
 
@@ -298,12 +298,24 @@ public final class JettyService
         }
 
         connector.setPort(this.config.getHttpsPort());
-        connector.setMaxIdleTime(60000);
+        configureConnector(connector);
 
         this.server.addConnector(connector);
     }
 
-    private void configureSessionManager(final Context context) {
+    private void configureConnector(final Connector connector)
+    {
+        connector.setMaxIdleTime(60000);
+        connector.setHost(this.config.getHost());
+        connector.setStatsOn(this.config.isRegisterMBeans());
+
+        // connector.setLowResourceMaxIdleTime(ms);
+        // connector.setRequestBufferSize(requestBufferSize);
+        // connector.setResponseBufferSize(responseBufferSize);
+    }
+
+    private void configureSessionManager(final Context context)
+    {
         final SessionManager manager = context.getSessionHandler().getSessionManager();
         manager.setSessionCookie(this.config.getProperty(SessionManager.__SessionCookieProperty,
SessionManager.__DefaultSessionCookie));
         manager.setSessionURL(this.config.getProperty(SessionManager.__SessionURLProperty,
SessionManager.__DefaultSessionURL));



Mime
View raw message