FELIX-2687 Applied patch by Florent Andre (thanks alot) adding support for connection timeout specification with a new  org.apache.felix.http.timeout property.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1197027 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 180e966..6a8d6a2 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
@@ -35,6 +35,9 @@
     /** Standard OSGi port property for HTTPS service */
     private static final String HTTPS_PORT = "org.osgi.service.http.port.secure";
 
+    /** Felix specific property to set http reaching timeout limit */
+    public static final String HTTP_TIMEOUT = "org.apache.felix.http.timeout";
+
     /** Felix specific property to enable debug messages */
     private static final String FELIX_HTTP_DEBUG = "org.apache.felix.http.debug";
     private static final String HTTP_DEBUG = "org.apache.felix.http.jetty.debug";
@@ -84,6 +87,7 @@
     private String host;
     private int httpPort;
     private int httpsPort;
+    private int httpTimeout;
     private String keystore;
     private String password;
     private String keyPassword;
@@ -168,6 +172,11 @@
         return this.httpsPort;
     }
 
+    public int getHttpTimeout()
+    {
+        return this.httpTimeout;
+    }
+
     public String getKeystore()
     {
         return this.keystore;
@@ -222,6 +231,7 @@
         this.host = getProperty(props, FELIX_HOST, null);
         this.httpPort = getIntProperty(props, HTTP_PORT, 8080);
         this.httpsPort = getIntProperty(props, HTTPS_PORT, 8443);
+        this.httpTimeout = getIntProperty(props, HTTP_TIMEOUT, 60000);
         this.keystore = getProperty(props, FELIX_KEYSTORE, this.context.getProperty(OSCAR_KEYSTORE));
         this.password = getProperty(props, FELIX_KEYSTORE_PASSWORD, this.context.getProperty(OSCAR_KEYSTORE_PASSWORD));
         this.keyPassword = getProperty(props, FELIX_KEYSTORE_KEY_PASSWORD, this.context.getProperty(OSCAR_KEYSTORE_KEY_PASSWORD));
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 5fdb887..7d63625 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
@@ -305,7 +305,7 @@
 
     private void configureConnector(final Connector connector)
     {
-        connector.setMaxIdleTime(60000);
+        connector.setMaxIdleTime(this.config.getHttpTimeout());
         connector.setHost(this.config.getHost());
         connector.setStatsOn(this.config.isRegisterMBeans());
 
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
index 7034cb2..af78f58 100644
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -35,6 +35,11 @@
 org.osgi.service.http.port.secure.description = Port to listen on for HTTPS \
  requests. Defaults to 433.
 
+org.apache.felix.http.timeout.name = Connection Timeout
+org.apache.felix.http.timeout.description = Time limit for reaching an \
+ timeout specified in milliseconds. This property applies to both HTTP \
+ and HTTP connections. Defaults to 60 seconds. 
+
 org.apache.felix.http.debug.name = Debug Logging
 org.apache.felix.http.debug.description = Whether to write DEBUG level \
  messages or not. Defaults to false.
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
index 82ceeed..8e308e8 100644
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
@@ -4,6 +4,7 @@
         <AD id="org.apache.felix.http.enable" type="Boolean" default="true" name="%org.apache.felix.http.enable.name" description="%org.apache.felix.http.enable.description"/>
         <AD id="org.osgi.service.http.port" type="Integer" default="8080" name="%org.osgi.service.http.port.name" description="%org.osgi.service.http.port.description"/>
         <AD id="org.apache.felix.http.nio" type="Boolean" default="true" name="%org.apache.felix.http.nio.name" description="%org.apache.felix.http.nio.description"/>
+	    <AD id="org.apache.felix.http.timeout" type="Integer" default="60000" name="%org.apache.felix.http.timeout.name" description="%org.apache.felix.http.timeout.description"/>
         <AD id="org.apache.felix.https.enable" type="Boolean" default="false" name="%org.apache.felix.https.enable.name" description="%org.apache.felix.https.enable.description"/>
         <AD id="org.osgi.service.http.port.secure" type="Integer" default="433" name="%org.osgi.service.http.port.secure.name" description="%org.osgi.service.http.port.secure.description"/>
         <AD id="org.apache.felix.https.nio" type="Boolean" default="true" name="%org.apache.felix.https.nio.name" description="%org.apache.felix.https.nio.description"/>